|
|
|
|
|
by protomikron
2855 days ago
|
|
> The program can certainly prepare itself for validating that data, and reject the v2 if it's not prepared for it, but then what do you do? To me "crashing" that entire page is a reasonable way to get around that for some programs. Such stuff is mostly handled via types like `Maybe APIResponse` or `Either ErrorMsg APIResponse`, so the type systems can guarantee that you handle both cases. And handling the error case (even if it's just a simple message to the user like "Error: Unable to fetch new weather data for location X/Y") is better then just crashing. I mean it depends on your definition of crashing, but I consider it similar to undefined behaviour. So I greatly prefer $ ./fetch_weather $location
panic: unable to fetch new weather data for location X/Y
to $ ./fetch_weather $location
Segmentation fault
and I guess most people do (where segfault is similar to 500 Internal Server Error which is equally bad). |
|