Kayrock.ErrorCode (kayrock v0.1.15) View Source

Utility for converting Kafka error codes to/from atom names

Note the actual error code values are determined by :kpro_schema.c/1. Currently covering the range -1 to 71.

See https://kafka.apache.org/protocol#protocol_error_codes

Link to this section Summary

Types

An erlang/elixir atom representation of an error code

A numeric Kafka error code

Functions

Converts an atom to a numeric error code

Converts an atom to a numeric error code, raising an Kayrock.ErrorCode.InvalidAtomException if an unknown atom is supplied

Converts an error code to an atom

Converts an error code to an atom, raising an Kayrock.ErrorCode.InvalidErrorCodeException if an unknown error code is supplied

Link to this section Types

Specs

error_atom() :: atom()

An erlang/elixir atom representation of an error code

Specs

error_code() :: integer()

A numeric Kafka error code

Link to this section Functions

Specs

atom_to_code(error_atom()) :: error_code() | nil

Converts an atom to a numeric error code

Returns nil if an unknown atom is supplied

Specs

atom_to_code!(error_atom()) :: error_code()

Converts an atom to a numeric error code, raising an Kayrock.ErrorCode.InvalidAtomException if an unknown atom is supplied

Specs

code_to_atom(error_code()) :: error_atom()

Converts an error code to an atom

An unknown code results in a return of :unknown

Specs

code_to_atom!(error_code()) :: error_atom()

Converts an error code to an atom, raising an Kayrock.ErrorCode.InvalidErrorCodeException if an unknown error code is supplied

Specs

unknown_topic() :: error_code()