Mserror.NetworkError exception (mscmp_syst_network v0.1.0)
Defines errors and related metadata for MscmpSystNetwork component errors.
Summary
Types
Represents the available Kinds of error allowed by this Error type.
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
@type kinds() :: :invalid_network | :parse
Represents the available Kinds of error allowed by this Error type.
Available Kinds
:parse- Indicates that there were problems attempting to parse an IP Address or Network represented as a string.:invalid_network- The value provided does not represent a valid network.
@type t() :: %Mserror.NetworkError{ __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, seekinds/0for the available Kinds.message- A string describing the error.context- contextual information for better understanding the error. If provided, the context should be of typeMscmpSystError.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
Creates a new error struct with the given kind, message, and options.
Parameters
kind- The kind of error, seekinds/0for 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 typeMscmpSystError.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 withMscmpSystError.Types.parsable_error/0to be parsed overriding certain attributes of the exception struct. When provided themessageparameter is treated as a default message which can be overridden by a message supplied by the error result provided to this option. Thecauseattribute of the exception struct will be set to a value derived from this option's value, ignoring the:causeoption if provided; typically you would not provide both:parse_errorand:causein the same call tonew/3.
Returns
Returns a struct of this error type with the error details.