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
Improve error reporting #9499
Improve error reporting #9499
Conversation
f0a13c6
to
1cfbc43
Compare
Codecov Report
@@ Coverage Diff @@
## master #9499 +/- ##
==========================================
- Coverage 86.83% 86.76% -0.08%
==========================================
Files 328 322 -6
Lines 12050 12033 -17
==========================================
- Hits 10464 10440 -24
- Misses 1586 1593 +7
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job 👏 I've managed to spot only a minor typo in one of the error codes, otherwise it looks great
lib/classes/PluginManager.js
Outdated
throw new ServerlessError( | ||
`Custom variable resolver for ${variablePrefix} defined by ${pluginName} ` + | ||
"specifies isDisabledAtPrepopulation but doesn't provide a string for a name", | ||
'USTOM_LEGACY_VARIABLES_RESOLVER_INVALID_CONFIGURATION' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's C
missing at the beginning of error code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find! Fixed
@@ -167,7 +169,7 @@ module.exports = async (exception, options = {}) => { | |||
code: exception.code, | |||
}; | |||
|
|||
if (!isUserError || !exception.code) { | |||
if (!isUserError || !exception.code || !isErrorCodeNormative(exception.code)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great call with including location
for such errors as well
1cfbc43
to
8057cca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done 👏
With goal to improve specificity of error codes in telemetry reports
ServerlessError
constructor (otherwise they're assumed as programmer error)resources
and crashing here on that, prevented failing with meaningful error message)ValidationError
which was not perfectly clear where it comes from)sls stats
command