-
Notifications
You must be signed in to change notification settings - Fork 1
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
Favor empty array over error when retrieving departures #13
Comments
Could you please give an example of URL which produced this error? I've managed to force
Then, I'm not really sure if giving an empty list of departures is a good idea. This is an exception this should be masked as a normal data. An empty list of departures would mean "we have no departures at this station/date/time". But that's not the case. We may very well have departures but they may be out of the timetable period (like in the URL above). I think these are different situations which should be handled differently. OK, this shouln't be |
Honestly I think it is perfectly valid to return an empty array in this case, there is nothing unexpected or exceptional here. Exceptionally would be an incorrectly formatted parameter (e.g. date), the id is incorrect or an internal server error occured...
This looks to me like it will lead in many languages to code that looks like this:
Personally I am dying a little inside looking at that. |
It is important to distinguish "no departures on this date" vs. "date outside of the supported timetable period" ( This may be different for |
Ok I get what you mean now. I guess in the case of being outside of the supported timetable period this is perfectly reasonable. |
I think it would be better if the response would return an empty array. It's pretty messy to handle otherwise on the clientside.
Suggestion:
The text was updated successfully, but these errors were encountered: