-module(gose). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/gose.gleam"). -export([error_message/1]). -export_type([gose_error/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC( " A Gleam JOSE (JSON Object Signing and Encryption) library.\n" "\n" " - `gose/jwa` — Algorithm identifiers ([RFC 7518](https://www.rfc-editor.org/rfc/rfc7518.html))\n" " - `gose/jwe` — Encryption ([RFC 7516](https://www.rfc-editor.org/rfc/rfc7516.html))\n" " - `gose/jwk` — Key management ([RFC 7517](https://www.rfc-editor.org/rfc/rfc7517.html))\n" " - `gose/jws` — Digital signatures ([RFC 7515](https://www.rfc-editor.org/rfc/rfc7515.html))\n" " - `gose/jwt` — JSON Web Tokens ([RFC 7519](https://www.rfc-editor.org/rfc/rfc7519.html))\n" "\n" " This module defines `GoseError`, the shared error type for JWS, JWE, and JWK.\n" " The JWT layer has its own `JwtError` with richer domain-specific variants.\n" ). -type gose_error() :: {parse_error, binary()} | {crypto_error, binary()} | {invalid_state, binary()}. -file("src/gose.gleam", 39). ?DOC( " Extract the message string from a GoseError, regardless of variant.\n" "\n" " ## Parameters\n" "\n" " - `error` - The error to extract the message from.\n" "\n" " ## Returns\n" "\n" " The human-readable description string contained in the error variant.\n" ). -spec error_message(gose_error()) -> binary(). error_message(Error) -> case Error of {parse_error, Msg} -> Msg; {crypto_error, Msg@1} -> Msg@1; {invalid_state, Msg@2} -> Msg@2 end.