Created
June 8, 2020 14:52
-
-
Save saml/fe53cfbf6812cc85a73363e8a9c63ad0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthError extends Error { | |
constructor(message) { | |
super(message); | |
// Error.captureStackTrace(this, AuthError); | |
} | |
} | |
function f(o) { | |
try { | |
const [_, token] = o.authorization.split('Bearer '); | |
return token; | |
} catch (err) { | |
throw new AuthError('Authorization header is malformed'); | |
} | |
} | |
// I want stacktrace to include | |
// TypeError: Cannot read property 'authorization' of undefined | |
f(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment