Err(T)
Result error .
Constructors
[](exception) : Err
Syntax sugar for Err.fail(exception).
exception must be an Exception or a String.
Err["Oops"] # => same as Err.fail("Oops")
conflict(exception) : Err
Creates a new Err instance with the status :conflict.
This method is a shortcut for Err.new :conflict, exception.
res = Err.conflict(exception)
res.status # => :conflict
# Raise
res.unwrap
# Or get the exception value
pp res.value
fail(exception) : Err
Creates a new Err instance with the status :fail.
This method is a shortcut for Err.new :fail, exception.
res = Err.fail(exception)
res.status # => :fail
# Raise
res.unwrap
# Or get the exception value
pp res.value
input(exception) : Err
Creates a new Err instance with the status :input.
This method is a shortcut for Err.new :input, exception.
res = Err.input(exception)
res.status # => :input
# Raise
res.unwrap
# Or get the exception value
pp res.value
new(exception : T)
Sourcenot_allowed(exception) : Err
Creates a new Err instance with the status :not_allowed.
This method is a shortcut for Err.new :not_allowed, exception.
res = Err.not_allowed(exception)
res.status # => :not_allowed
# Raise
res.unwrap
# Or get the exception value
pp res.value
Class methods
Instance methods
status
Result status as a Symbol (:done or :fail, etc).