I'm wondering what's an acceptable approach to parsing JSON from third-party services considering deserialization errors.
For example, this service method:
def signInWithEmailAndPassword(email: String, password: String): Future[ApiResponse[SignInResponse]] =
request("/signin").post(Json.obj("email" -> email, "password" -> password))
.map(_.json.as[ApiResponse[SignInResponse]])
Will throw a server exception if json.as
fails which play will catch in the default error handler.
Is that an OK structuring of the client? Seems like a JSON parse error is not really recoverable anyway, so uses the generic error handler is appropriate?