kayrock v0.1.6 Kayrock.ErrorCode 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

Link to this type

error_atom() View Source
error_atom() :: atom()

An erlang/elixir atom representation of an error code

Link to this type

error_code() View Source
error_code() :: integer()

A numeric Kafka error code

Link to this section Functions

Link to this function

atom_to_code(atom) View Source
atom_to_code(error_atom()) :: error_code() | nil

Converts an atom to a numeric error code

Returns nil if an unknown atom is supplied

Link to this function

atom_to_code!(atom) View Source
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

Link to this function

code_to_atom(code) View Source
code_to_atom(error_code()) :: error_atom()

Converts an error code to an atom

An unknown code results in a return of :unknown

Link to this function

code_to_atom!(code) View Source
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

Link to this function

unknown_topic() View Source
unknown_topic() :: error_code()