rockbox/error
Types
Errors returned from any SDK call.
Pattern-match in your callers to react differently to network problems vs. upstream GraphQL errors:
case playback.current_track(client) {
Ok(track) -> echo track
Error(error.NetworkError(_)) -> retry()
Error(error.GraphQLError(messages)) -> log_errors(messages)
Error(_) -> Nil
}
pub type Error {
NetworkError(reason: String)
HttpError(status: Int, body: String)
GraphQLError(messages: List(String))
DecodeError(reason: String)
}
Constructors
-
NetworkError(reason: String)Could not reach the server (DNS, refused connection, TLS, etc).
-
HttpError(status: Int, body: String)Server returned a non-2xx HTTP response.
-
GraphQLError(messages: List(String))GraphQL endpoint returned a populated
errorsarray. -
DecodeError(reason: String)Response body could not be decoded into the expected shape.