Class ForbiddenError
Represents an authorization error (HTTP 403 equivalent). Use when the caller is authenticated but lacks permission.
public class ForbiddenError : Reason<ForbiddenError>, IError, IReason
- Inheritance
-
ForbiddenError
- Implements
- Inherited Members
- Extension Methods
Examples
Result<User>.Fail(new ForbiddenError());
Result<User>.Fail(new ForbiddenError("Admin role required"));
Result<User>.Fail(new ForbiddenError("Delete", "Order"));
Constructors
ForbiddenError()
public ForbiddenError()
ForbiddenError(string)
public ForbiddenError(string message)
Parameters
messagestring
ForbiddenError(string, string)
public ForbiddenError(string action, string resource)
Parameters
Methods
CreateNew(string, ImmutableDictionary<string, object>)
Factory method for creating new instances (maintains immutability). Must be implemented by derived classes.
protected override ForbiddenError CreateNew(string message, ImmutableDictionary<string, object> tags)
Parameters
messagestringtagsImmutableDictionary<string, object>