guardian / facia-scala-client

Low level client for the Facia JSON API
Other
2 stars 1 forks source link

Territory exhaustive match #255

Closed davidfurey closed 3 years ago

davidfurey commented 3 years ago

What does this change?

When preparing to release this library I noticed a warning about a non-exhaustive pattern match. This PR makes the match exhaustive, returning a JSON parse error instead of throwing an exception if asked to parse an unknown territory.

mchv commented 2 years ago

@davidfurey I think another improvement could be to turn non-exhaustive pattern matching warnings to errors with something like Xfatal-warnings in this project. What do you think?

davidfurey commented 2 years ago

@mchv - indeed, I've opened https://github.com/guardian/facia-scala-client/pull/259 with this change

I'd appreciate your thoughts on https://github.com/guardian/facia-scala-client/pull/258 which should avoid new territories breaking out-of-date clients in future.