View Source Kayrock.ErrorCode (kayrock v0.2.0)

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

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

Types

@type error_atom() :: atom()

An erlang/elixir atom representation of an error code

@type error_code() :: integer()

A numeric Kafka error code

Functions

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

Converts an atom to a numeric error code

Returns nil if an unknown atom is supplied

@spec 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

@spec code_to_atom(error_code()) :: error_atom()

Converts an error code to an atom

An unknown code results in a return of :unknown

@spec 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

@spec unknown_topic() :: error_code()