Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

api: report 400 if plan or feature not found #212

Merged
merged 1 commit into from
Jan 9, 2023
Merged

api: report 400 if plan or feature not found #212

merged 1 commit into from
Jan 9, 2023

Conversation

bmizerany
Copy link
Contributor

@bmizerany bmizerany commented Jan 9, 2023

Previously, the API would return a 500 if the user supplied a non-existent feature or plan.

There is more work to do on error reporting, but this commit provides clarity to the user with a clear error message.

Fixes #211

// TERR1010: org or features problem
// TERR2000: internal errors
var errorLookup = map[error]*trweb.HTTPError{
control.ErrOrgNotFound: {
Status: 400,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

400 is fine, but sort of feels like these "not found" errors should be 404s?

LGTM, just a bikeshed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I POST /v1/schedule it's a 400, and I think it should stay that, but we can change it to a 404 for /v1/whoami if it is not that way already.

Previously, the API would return a 500 if the user supplied a
non-existent feature or plan.

There is more work to do on error reporting, but this commit provides
clarity to the user with a clear error message.

Fixes #211
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal Server Error when subscribing to plan that does not exist
2 participants