result
The Result type returned by every service method, along with its
Ok and Err variants. See the
result guide for how to branch on it.
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
unwrap_err
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
Converts the result into a dictionary.
If this result is Ok, the "value" property will be set.
If this result is Err, the "error" property will be set.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The requested dictionary. |
Source code in wom/result.py
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
|