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

Return error when token is empty, undefined, or null. #13

Merged
merged 1 commit into from
Apr 13, 2015

Conversation

michaelckelly
Copy link
Contributor

Currently, a call like:

authy.verify(authyUserId, twoFactorCode, callback);

will return

{ message: 'Requested URL was not found. Please check http://docs.authy.com/ to see the valid URLs',
  success: false,
  errors: { message: 'Requested URL was not found. Please check http://docs.authy.com/ to see the valid URLs' } }

when twoFactorCode is equal to '', null, or undefined.

I think it'd be clearer to callback with a direct error here (in this case, that the token cannot be null/missing) as opposed to returning a more obscure 404 API response.

(originally at https://github.com/authy/node-authy/pull/1)

@dacbd
Copy link
Collaborator

dacbd commented Apr 10, 2015

can you make it return an Error rather than just a String.

@evilpacket
Copy link
Owner

+1 to Error objects

@michaelckelly
Copy link
Contributor Author

@danielbarnes and @evilpacket:

Sure thing - updated to callback an Error object.

dacbd added a commit that referenced this pull request Apr 13, 2015
Return error when token is empty, undefined, or null.
@dacbd dacbd merged commit 6435a39 into evilpacket:master Apr 13, 2015
@dacbd
Copy link
Collaborator

dacbd commented Apr 13, 2015

1.1.2

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.

3 participants