Class UnauthorizedError
Represents an authentication error (HTTP 401 equivalent). Use when the caller is not authenticated or credentials are invalid.
public class UnauthorizedError : Reason<UnauthorizedError>, IError, IReason
- Inheritance
-
UnauthorizedError
- Implements
- Inherited Members
- Extension Methods
Examples
Result<User>.Fail(new UnauthorizedError());
Result<User>.Fail(new UnauthorizedError("Token has expired"));
Constructors
UnauthorizedError()
public UnauthorizedError()
UnauthorizedError(string)
public UnauthorizedError(string message)
Parameters
messagestring
Methods
CreateNew(string, ImmutableDictionary<string, object>)
Factory method for creating new instances (maintains immutability). Must be implemented by derived classes.
protected override UnauthorizedError CreateNew(string message, ImmutableDictionary<string, object> tags)
Parameters
messagestringtagsImmutableDictionary<string, object>