result
This module contains the Result
variants returned by
all Client
calls.
Correct usage
Incorrect usage
Err
Bases: Result[T, E]
Info
You will receive instances of this class as a result of
calling Client
methods, and should not have to
instantiate it yourself.
Source code in wom/result.py
to_dict
Converts the result into a dictionary.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The requested dictionary. |
unwrap
Always throws an exception for the Err
variant.
Raises:
Type | Description |
---|---|
UnwrapError
|
Because the result was an |
Source code in wom/result.py
Ok
Bases: Result[T, E]
Info
You will receive instances of this class as a result of
calling Client
methods, and should not have to
instantiate it yourself.
Source code in wom/result.py
to_dict
Converts the result into a dictionary.
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
The requested dictionary. |
unwrap
unwrap_err
Always throws an exception for the Ok
variant.
Raises:
Type | Description |
---|---|
UnwrapError
|
Because the result was an |
Source code in wom/result.py
Result
Bases: Generic[T, E]
, ABC
Represents a potential Ok
or Err
result.
Note
This class cannot be instantiated, only its variants can be.
Source code in wom/result.py
to_dict
abstractmethod
unwrap
abstractmethod
Unwraps the result to produce the value.
Returns:
Type | Description |
---|---|
T
|
The unwrapped value. |
Raises:
Type | Description |
---|---|
UnwrapError
|
unwrap_err
abstractmethod
Unwraps the result to produce the error.
Returns:
Type | Description |
---|---|
E
|
The unwrapped error. |
Raises:
Type | Description |
---|---|
UnwrapError
|