CDRH / orchid

Rails Engine for site integration with CDRH API
MIT License
3 stars 0 forks source link

Handling API-related errors #256

Open wkdewey opened 1 year ago

wkdewey commented 1 year ago

Currently, if the API is down or a request gets a 500 server error, the error messages are not informative, and Rails just displays an error about @res being nil. I think we could improve this and direct developers to elasticsearch logs or an API endpoint to investigate the error.

techgique commented 1 year ago

I think that's what we were trying to do with https://github.com/CDRH/orchid/blob/dev/app/controllers/items_controller.rb#L86. We probably want this kind of API error handling to behave differently in the dev environment than production. In dev we'd want to output the raw response to help debugging. In production we want a friendlier error that doesn't expose internal operation information.