Class RangeNotSatisfiableError
- Namespace
- Trellis
- Assembly
- Trellis.Results.dll
Represents a range not satisfiable error when the server cannot serve the requested byte range for a resource. Maps to HTTP 416 Range Not Satisfiable.
public sealed class RangeNotSatisfiableError : Error, IEquatable<Error>
- Inheritance
-
RangeNotSatisfiableError
- Implements
- Inherited Members
- Extension Methods
Examples
Error.RangeNotSatisfiable("Requested range is not satisfiable.", 1024)
Remarks
Per RFC 9110 §14.4/§15.5.17, a server generating 416 for a byte-range request
SHOULD include a Content-Range: bytes */{completeLength} header.
The CompleteLength and Unit properties carry this metadata
so that Trellis response mappers can emit the required header automatically.
Constructors
RangeNotSatisfiableError(string, long, string, string, string?)
Initializes a new instance of the RangeNotSatisfiableError class.
public RangeNotSatisfiableError(string detail, long completeLength, string code, string unit = "bytes", string? instance = null)
Parameters
detailstringDescription of why the range is not satisfiable.
completeLengthlongThe complete length of the representation.
codestringThe error code identifying this type of error.
unitstringThe range unit (defaults to "bytes").
instancestringOptional identifier for the resource.
Properties
CompleteLength
Gets the complete length of the selected representation in the specified unit.
Used to emit the Content-Range header (e.g., bytes */1024).
public long CompleteLength { get; }
Property Value
Unit
Gets the range unit (defaults to "bytes").
public string Unit { get; }