View Source Arke.Utils.ErrorGenerator (Arke v0.1.38)

Documentation for Arke.Utils.ErrorGenerator

Summary

Functions

Create standardized errors

Types

@type t() :: {:error, [%{context: String.t(), message: String.t()}]}

Functions

@spec create(context :: String.t(), errors :: list() | String.t()) ::
  {:error, [%{context: String.t(), message: String.t()}]}

Create standardized errors

Parameters

  • context => string => the context where the error has been generated
  • errors => list | string => the error itself

Example

iex> Arke.Utils.ErrorGenerator.create(:auth, "login error")

Return

 {:error , [%{context: "context_value", message: "message_value"}, ...]}