Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Exclude internal stack frames from littering error messages #213

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Avaq
Copy link
Member

@Avaq Avaq commented Jul 1, 2018

Opening the PR because I'm not sure when I'll get back to it, so it can serve as a start.

These changes show an approach to tackling issues like #64 and (maybe) #212 using Error.captureStacktrace from V8 to trim the stack frames that were created inside sanctuary-def to facilitate forming the Error away from the stack traces.

@@ -2061,12 +2067,12 @@
//. Multiple constraints may be placed on a type variable by including
//. multiple `TypeClass` values in the array (e.g. `{a: [Foo, Bar, Baz]}`).

// invalidArgumentsCount :: (TypeInfo, Integer, Integer, Array Any) -> Error
// invalidArgumentsCount :: (TypeInfo, Integer, Integer, Array Any, Function) -> Error
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This line is too long now. Argument types should be moved into the argument list as is done with other functions.

@@ -239,6 +239,9 @@
// always2 :: a -> (b, c) -> a
function always2(x) { return function(y, z) { return x; }; }

// captureStackTrace :: Assignable a => (a, Function) -> a
var captureStackTrace = Error.captureStackTrace || noop;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the return type be Undefined rather than a? As written noop should not be used here because it does not return its first argument.

Copy link
Member Author

@Avaq Avaq Jul 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're right. Error.captureStackTrace does actually return undefined.

@davidchambers
Copy link
Member

I would love to see you revive this pull request, Aldwin. :)

@Avaq
Copy link
Member Author

Avaq commented Apr 10, 2019

I probably will. I am aware if its existence, and it's one of many things on my ever-evolving to-do list. :P
I'm trying out a thing in my latest rework of Fluture, which, if successful, might make its way into a small library that we can base this PR on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants