Table of Contents

Class BadRequestError

Namespace
FunctionalDdd
Assembly
FunctionalDdd.RailwayOrientedProgramming.dll

Represents a bad request error indicating the request was malformed or syntactically invalid. Use this for requests that cannot be processed due to syntax errors, missing required data, or malformed content. Maps to HTTP 400 Bad Request.

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

Examples

Error.BadRequest("Request body is not valid JSON")
Error.BadRequest("Missing required header: Authorization")
Error.BadRequest("Invalid date format in query parameter")

Remarks

Use BadRequestError for syntactic errors (malformed JSON, missing required fields, invalid format). For business rule violations, use ValidationError or DomainError instead.

This represents a client error that should not be retried without modification.

Constructors

BadRequestError(string, string, string?)

Initializes a new instance of the BadRequestError class.

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

Parameters

detail string

Description of why the request is bad.

code string

The error code identifying this type of bad request error.

instance string

Optional identifier for the bad request.