Table of Contents

Class ForbiddenError

Namespace
FunctionalDdd
Assembly
FunctionalDdd.RailwayOrientedProgramming.dll

Represents a forbidden error when an authenticated user lacks permission to access a resource. Use this when the user is authenticated but does not have the required authorization or role. Maps to HTTP 403 Forbidden.

public sealed class ForbiddenError : Error, IEquatable<Error>
Inheritance
ForbiddenError
Implements
Inherited Members
Extension Methods

Examples

Error.Forbidden("You do not have permission to delete this resource")
Error.Forbidden("Administrator role required for this operation")
Error.Forbidden("Cannot access another user's private information")

Remarks

This is distinct from UnauthorizedError which indicates missing authentication. ForbiddenError means the user is known but not allowed to perform the requested operation.

Common scenarios: - User lacks required role or permission - Resource owner attempting to access another user's private data - Insufficient privileges for administrative operations

Constructors

ForbiddenError(string, string, string?)

Initializes a new instance of the ForbiddenError class.

public ForbiddenError(string detail, string code, string? instance = null)

Parameters

detail string

Description of why access is forbidden.

code string

The error code identifying this type of forbidden error.

instance string

Optional identifier for the forbidden resource.