Class Error
- Namespace
- Rascal
- Assembly
- Rascal.dll
An error containing a simple message. Makes up the other half of a Result<T> which might be an error.
public abstract class Error
- Inheritance
-
Error
- Derived
- Inherited Members
- Extension Methods
Remarks
An error is conceptually akin to an exception but without the ability to be thrown, meant to be a more lightweight type meant to be wrapped in a Result<T>. An error fundamentally only contains a single string message, however other more concrete types such as ExceptionError or AggregateError may define other properties. Errors are meant to be small, specific, and descriptive, such that they are easy to match over and provide specific handling for specific kinds of errors.
Properties
Message
The message used to display the error.
public abstract string Message { get; }
Property Value
- string
- An error containing a simple message. Makes up the other half of a which might be an error.
Methods
ToString()
Gets a string representation of the error. Returns Message by default.
public override string ToString()
Returns
- string
- An error containing a simple message. Makes up the other half of a which might be an error.
Operators
implicit operator Error(Exception)
Implicitly converts an exception into an ExceptionError.
public static implicit operator Error(Exception exception)
Parameters
exception
ExceptionThe exception to convert.
Returns
- Error
- An error containing a simple message. Makes up the other half of a which might be an error.
implicit operator Error(string)
Implicitly converts a string into a StringError.
public static implicit operator Error(string message)
Parameters
message
stringThe message of the error.
Returns
- Error
- An error containing a simple message. Makes up the other half of a which might be an error.