Skip to content

Error/raise points to wrong function #11

@FinlayDaG33k

Description

@FinlayDaG33k

With the massive changes coming in #7, we've added a raise function to more easily allow us to raise errors through null-coalescing, as this is not natively supported by TypeScript at the moment.

However, this issue causes stacktraces to point to the raise function itself rather than the place where raise was called:

const whatever = blablabla.bla ?? raise('Test', BlahError);
error: Uncaught BlahError: Test
    const e = new Error(err);
              ^
    at raise (file:///F:/repos/FinlayDaG33k/chomp/error/raise.ts:14:15)
    at file:///F:/repos/FinlayDaG33k/chomp/error/raise.ts:23:1

This should be fixed so that stacktraces allow people to more easily find where something goes wrong.
I think Error.captureStackTrace might help for a solution but I'm currently unsure.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions