gleam/beam
Types
All reasons an that an erlang process might by the runtime.
http://erlang.org/documentation/doc-9.3/doc/reference_manual/errors.html#exit_reasons
Note erlang:exit
and erlang:error
can be called with any term.
Therefore when captureing errors always make sure to safely cast to this type, i.e. using cast_exit_reason
pub type ExitReason { Badarg Badarith Badmatch(Dynamic) FunctionClause CaseClause(Dynamic) IfClause TryClause(Dynamic) Undef Badfun(Dynamic) Badarity(Dynamic) TimeoutValue Noproc Nocatch(Dynamic) SystemLimit }
Constructors
-
Badarg
-
Badarith
-
Badmatch(Dynamic)
-
FunctionClause
-
CaseClause(Dynamic)
-
IfClause
-
TryClause(Dynamic)
-
Undef
-
Badfun(Dynamic)
-
Badarity(Dynamic)
-
TimeoutValue
-
Noproc
-
Nocatch(Dynamic)
-
SystemLimit
A stacktrace data structure
pub type Stacktrace = List(tuple(Atom, String, Int, String, Int))
Functions
pub fn binary_to_term(binary: BitString) -> Result(Dynamic, Nil)
pub fn cast_exit_reason( raw: Dynamic, ) -> Result(ExitReason, String)
Safely transform dynamic to exit reason type
pub fn cast_stacktrace( raw: Dynamic, ) -> Result(List(tuple(Atom, String, Int, String, Int)), String)
Safely cast a dynamic stacktrace to typed data.
pub external fn term_to_binary(a) -> BitString
pub fn unsafe_binary_to_term( binary: BitString, ) -> Result(Dynamic, Nil)