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

Error Codes #20

Open
trentgoing opened this issue May 16, 2021 · 1 comment
Open

Error Codes #20

trentgoing opened this issue May 16, 2021 · 1 comment

Comments

@trentgoing
Copy link

res.status(404).send('Could not retrieve the answers.')

Currently 404 catches all errors and only responds if "Something went wrong". Could the types of errors returned be more specific? For example, if parameters are invalid, this should ideally return a different error code than if the parameters were correct but no resource was found (the number isn't in the dataset).

@kennyctran
Copy link
Collaborator

@trentgoing Hmmm great point. I did see a great pattern in the Mongoose code where each function in the process threw an error with a specific string. That string was then checked with a function to see which error code it was. Once the string was matched, that was the error thrown and sent back to the console. I could implement something like that for this.

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

No branches or pull requests

2 participants