Error
struct Error
This type represents an Error.
Implemented traits
AnyType,
Copyable,
ImplicitlyDestructible,
Movable,
Writable
Methods
__init__
@implicit
__init__(out self, var value: String, *, depth: Int = -1)
Construct an Error object with a given String.
Args:
@implicit
__init__(out self, value: StringLiteral[value.value])
Construct an Error object with a given string literal.
Args:
- value (
StringLiteral): The error message.
@implicit
__init__(out self, value: T)
Construct an Error object from a Writable argument.
Args:
- value (
T): The Writable argument to store in the error message.
__init__[*Ts: Writable](out self, *args: *Ts.values)
Construct an Error by concatenating a sequence of Writable arguments.
Parameters:
- *Ts (
Writable): The types of the arguments to format. Each type must be satisfyWritable.
Args:
- *args (
*Ts.values): A sequence of Writable arguments.
write_to
write_to(self, mut writer: T)
Formats this error to the provided Writer.
Args:
- writer (
T): The object to write to.
write_repr_to
write_repr_to(self, mut writer: T)
Formats this error to the provided Writer.
Args:
- writer (
T): The object to write to.
get_stack_trace
get_stack_trace(self) -> Optional[String]
Returns the stack trace of the error, if available.
Returns:
Optional: An Optional[String] containing the stack trace if one was
collected, or None if stack trace collection was disabled
or unavailable.