Typed exceptions for the Rockbox SDK.
All errors are clojure.lang.ExceptionInfo instances carrying a :type
key in their ex-data, so they can be discriminated with ex-data /
(:type ...) in a single catch ExceptionInfo block.
(try
(rb/query client "...")
(catch clojure.lang.ExceptionInfo e
(case (:type (ex-data e))
:rockbox/network (handle-offline e)
:rockbox/graphql (handle-server-error e)
(throw e))))
Typed exceptions for the Rockbox SDK.
All errors are `clojure.lang.ExceptionInfo` instances carrying a `:type`
key in their ex-data, so they can be discriminated with `ex-data` /
`(:type ...)` in a single `catch ExceptionInfo` block.
(try
(rb/query client "...")
(catch clojure.lang.ExceptionInfo e
(case (:type (ex-data e))
:rockbox/network (handle-offline e)
:rockbox/graphql (handle-server-error e)
(throw e))))(config-error msg)Throwable: client was constructed with bad/missing config.
Throwable: client was constructed with bad/missing config.
(graphql-error errors)Throwable: server returned {errors: [...]} in the response body.
errors is the raw vector from the server (kebabized maps).
Throwable: server returned `{errors: [...]}` in the response body.
`errors` is the raw vector from the server (kebabized maps).(graphql-error? e)True if e is a Rockbox GraphQL error.
True if `e` is a Rockbox GraphQL error.
(network-error msg)(network-error msg cause)Throwable: rockboxd is unreachable, or HTTP returned a non-2xx status.
Throwable: rockboxd is unreachable, or HTTP returned a non-2xx status.
(network-error? e)True if e is a Rockbox network error.
True if `e` is a Rockbox network error.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |