Mserror.DataUtilsError exception (mscmp_syst_utils_data v0.1.0)

This module defines the macro related error types for the Msutils.Data module.

Summary

Types

Represents the available Kinds of error allowed by this Error type.

t()

Describes the structure of an error of generated by this exception.

Functions

Creates a new error struct with the given kind, message, and options.

Types

kinds()

@type kinds() :: :ets_operations | :macro

Represents the available Kinds of error allowed by this Error type.

Available Kinds

  • :macro - Indicates that there were compilation errors in the macros provided by this Component. This will often times be due to invalid parameters being passed to the macros.

  • :ets_operations - Indicates that there was an error in an ETS operation.

t()

@type t() :: %Mserror.DataUtilsError{
  __exception__: true,
  __mscomponent__: module(),
  __mserror__: true,
  cause: t() | Exception.t() | term() | nil,
  context: MscmpSystError.Types.Context.t() | nil,
  kind: kinds(),
  message: String.t()
}

Describes the structure of an error of generated by this exception.

The cause attribute allows for errors to be nested.

Attributes

The following attributes are those which are set or modified by the user when working with errors.

  • kind - The kind of error, see kinds/0 for the available Kinds.

  • message - A string describing the error.

  • context - contextual information for better understanding the error. If provided, the context should be of type MscmpSystError.Types.Context.t/0.

  • cause - The cause of the error, which can be an exception, an error tuple, or any other term.

Internal Attributes

These attributes have their values set at compile time and are used internally by the MscmpSystError framework. They are not to be altered by user code. Reading these attributes in user code is safe, however.

  • __mserror__ - Always true, indicates that this error is compatible with the MscmpSystError framework.

  • __mscomponent__ - The component that generated the error.

Functions

new(kind, message, opts \\ [])

@spec new(kind :: kinds(), message :: String.t(), opts :: keyword()) :: t()

Creates a new error struct with the given kind, message, and options.

Parameters

  • kind - The kind of error, see kinds/0 for the available Kinds.

  • message - A string describing the error.

  • opts - A keyword list of additional options.

Options

  • :context - contextual information for better understanding the error. If provided, the context should be of type MscmpSystError.Types.Context.t/0.

  • :cause - The cause of the error, which can be an exception, an error tuple, or any other term.

  • :parse_error - An error result conforming with MscmpSystError.Types.parsable_error/0 to be parsed overriding certain attributes of the exception struct. When provided the message parameter is treated as a default message which can be overridden by a message supplied by the error result provided to this option. The cause attribute of the exception struct will be set to a value derived from this option's value, ignoring the :cause option if provided; typically you would not provide both :parse_error and :cause in the same call to new/3.

Returns

Returns a struct of this error type with the error details.