-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[librariesio] Missing try/catch block and tests #1644
Conversation
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.
@PyvesB Thanks, this looks great!
server.js
Outdated
|
||
request(options, function(err, res, json) { | ||
|
||
if (err || res.statusCode !== 200) { |
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.
Would you like to improve error handling by using
Line 8 in e1755df
const checkErrorResponse = function(badgeData, err, res, notFoundMessage = 'not found') { |
in this PR?
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.
Done, thanks for reviewing!
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.
Changes look good!
This pull request should close #1621 by adding our usual try/catch block. There weren't any tests for this service, so I implemented a simple test suite (one extra box ticked in #1358! 👍 ) and also got rid of the
var
keyword in favour of more appropriate identifiers.