Class UnexpectedError
- Namespace
- FunctionalDdd
- Assembly
- FunctionalDdd.RailwayOrientedProgramming.dll
Represents an unexpected system error or exception. Use this for infrastructure failures, unhandled exceptions, or system-level errors. Maps to HTTP 500 Internal Server Error.
public sealed class UnexpectedError : Error, IEquatable<Error>
- Inheritance
-
UnexpectedError
- Implements
- Inherited Members
- Extension Methods
Examples
Error.Unexpected("An unexpected error occurred")
Error.Unexpected("Database connection failed")
Error.Unexpected("Unable to process request due to internal error")
Remarks
This error type indicates something went wrong that the client cannot fix. It typically represents bugs, infrastructure issues, or unexpected system states.
Common scenarios: - Unhandled exceptions - Database connection failures - External service failures - Infrastructure issues - Null reference exceptions or other bugs
Avoid exposing sensitive system details in the detail message for security reasons.
Constructors
UnexpectedError(string, string, string?)
Initializes a new instance of the UnexpectedError class.
public UnexpectedError(string detail, string code, string? instance = null)