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

Provide more informative errors #16

Open
NoelAbrahams opened this issue Sep 30, 2019 · 0 comments
Open

Provide more informative errors #16

NoelAbrahams opened this issue Sep 30, 2019 · 0 comments

Comments

@NoelAbrahams
Copy link

NoelAbrahams commented Sep 30, 2019

This is a great tool BTW.

We have put in a work-around to fix the lack of informative errors. Should be self-explanatory:

// Re-trace simply crashes at random points if the stack is not valid
// Try to provide a more detailed error message
if (error.message === '"version" is a required argument.') {

    throw new Error(`The source map is not valid or the domain URL is incorrect; Used URL: ${sourceUrl}. Original Error:\n${error.message}`);
}
else if (error.message === 'Response code 400 (Bad Request)') {

    if (minifiedStack.includes(' (<anonymous>)')) {
        throw new Error(`Invalid Stack: Try removing line '(<anonymous>)'`);
    }
}
else if (native.string.startsWith(error.message, 'Protocol')) {

    if (minifiedStack.split('\n')[0].includes(':')) {
        throw new Error(`Invalid Stack: The first line resembles a URL. Try removing all colons.\nOriginal Error:\n${error.message}`);
    }
}

It will be great to have this handled by the library itself as the hack above doesn't really work in all cases.

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

No branches or pull requests

1 participant