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

Adding a sanity test in 'exists(path)' function #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ntma
Copy link

@ntma ntma commented Jun 6, 2020

Reason

There is at least one error type (ECONNRESET) in request that causes responses to be null. This will cause an uncaught error in the following line whenever this error occurs:

callback(e, res.statusCode <= 400);

Fix

Tests if any error is returned by the request before accessing the statusCode of the response.

Warning

This PR changes the signature of the callback in this function from: (error : Error, exists : boolean) to (error : Error, exists ?: boolean). Which means that if an error occurs, the boolean will not be returned!!!

closes #14

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

Successfully merging this pull request may close these issues.

Uncaught exception in method 'exists'
1 participant