Class UnauthorizedError

Namespace
REslava.Result
Assembly
REslava.Result.dll

Represents an authentication error (HTTP 401 equivalent). Use when the caller is not authenticated or credentials are invalid.

public class UnauthorizedError : Reason<UnauthorizedError>, IReasonMetadata, IError, IReason, IErrorFactory<UnauthorizedError>
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, string?, string?, int)

public UnauthorizedError(string message, string? callerMember = null, string? callerFile = null, int callerLine = 0)

Parameters

message string
callerMember string
callerFile string
callerLine int

Methods

Create(string)

Creates an instance of UnauthorizedError with the given message.

public static UnauthorizedError Create(string message)

Parameters

message string

Returns

UnauthorizedError

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

message string
tags ImmutableDictionary<string, object>

Returns

UnauthorizedError