RouterosApi.Error exception (RouterOS API v0.3.0)
View SourceError struct for RouterOS API errors.
Error Types
:trap- Error from RouterOS (e.g., invalid command, permission denied):fatal- Fatal error from RouterOS (connection will be closed):timeout- Network timeout:closed- Connection closed:auth_failed- Authentication failed:connection_failed- Failed to establish connection:stream_cancelled- Stream was cancelled:stream_error- Error during stream processing
Summary
Types
@type error_type() ::
:trap
| :fatal
| :timeout
| :closed
| :auth_failed
| :connection_failed
| :stream_cancelled
| :stream_error
@type t() :: %RouterosApi.Error{ __exception__: true, details: map(), message: String.t(), type: error_type() }
Functions
Implements the Exception behaviour message callback.
@spec new(error_type(), String.t(), map()) :: t()
Creates a new error struct.
Examples
iex> RouterosApi.Error.new(:trap, "no such item")
%RouterosApi.Error{type: :trap, message: "no such item", details: %{}}
iex> RouterosApi.Error.new(:timeout, "Connection timed out", %{timeout: 5000})
%RouterosApi.Error{type: :timeout, message: "Connection timed out", details: %{timeout: 5000}}