VBT.BusinessError (vbt v0.1.0) View Source

General purpose VBT business error.

Link to this section Summary

Functions

Creates a VBT business error.

Link to this section Types

Specs

t() :: %VBT.BusinessError{__vbt_error__: term(), error_code: term()}

Link to this section Functions

Specs

new(String.t(), String.t()) :: t()

Creates a VBT business error.

The scope parameter can consist of multiple parts separated by the . character. At the very least supply a single part which is the operation name, or a standard VBT scope (e.g. "registration" or "authentication").

The prefix com.vbt. will be prepended to the given scope.

The reason parameter represents the specific error reason (e.g. "already_taken", or "invalid_credentials").

Example:

iex> error = VBT.BusinessError.new("registration.login", "already_taken")

iex> error.error_code
"com.vbt.registration.login/already_taken"