Class ProblemDetailError
Create an Error that will be translated into a ProblemDetails. Detail will be assigned to the existing Message property of FluentResults.Error.
public class ProblemDetailError : Error, IError, IReason
- Inheritance
-
ErrorProblemDetailError
- Implements
-
IErrorIReason
- Inherited Members
-
Error.CausedBy(IError)Error.ToString()Error.MessageError.MetadataError.Reasons
Properties
Instance
Gets the URI reference identifying this occurrence of the problem (the instance member), or null when not set.
public string? Instance { get; }
Property Value
Severity
Gets the severity exposed as an extension of the ProblemDetails, or null when not set.
public string? Severity { get; }
Property Value
StatusCode
Gets the HTTP status code (the status member of the ProblemDetails), or null when not set.
public int? StatusCode { get; }
Property Value
- int?
Title
Gets the short summary of the problem type (the title member of the ProblemDetails), or null when not set.
public string? Title { get; }
Property Value
Type
Gets the URI identifying the problem type (the type member), or null when not set.
public Uri? Type { get; }
Property Value
Methods
Create(string)
Creates a ProblemDetailError whose FluentResults.Error.Message is the detail of the problem.
public static ProblemDetailError Create(string detail)
Parameters
detailstringThe human readable explanation, used as the
detailmember of the ProblemDetails.
Returns
- ProblemDetailError
The new error; complete it with the
With...methods.
WithInstance(string)
Sets the URI reference identifying this occurrence of the problem.
public ProblemDetailError WithInstance(string instance)
Parameters
instancestringThe instance URI reference.
Returns
- ProblemDetailError
This error, to chain calls.
WithMetadata(string, object)
Adds a metadata entry, exposed as an extension of the ProblemDetails, and returns this error.
public ProblemDetailError WithMetadata(string key, object value)
Parameters
Returns
- ProblemDetailError
This error, to chain calls.
Remarks
Unlike WithMetadata(string, object) this returns a ProblemDetailError. An existing key is kept: the call is then ignored.
WithSeverity(string)
Sets the severity exposed as an extension of the ProblemDetails.
public ProblemDetailError WithSeverity(string severity)
Parameters
Returns
- ProblemDetailError
This error, to chain calls.
WithStatusCode(int)
Sets the HTTP status code of the problem.
public ProblemDetailError WithStatusCode(int statusCode)
Parameters
statusCodeintThe HTTP status code.
Returns
- ProblemDetailError
This error, to chain calls.
WithTitle(string)
Sets the short summary of the problem type.
public ProblemDetailError WithTitle(string title)
Parameters
titlestringThe title.
Returns
- ProblemDetailError
This error, to chain calls.
WithType(Uri)
Sets the URI identifying the problem type.
public ProblemDetailError WithType(Uri type)
Parameters
typeUriThe problem type URI.
Returns
- ProblemDetailError
This error, to chain calls.
Operators
implicit operator Result(ProblemDetailError)
Converts the error to a failed FluentResults.Result containing it.
public static implicit operator Result(ProblemDetailError error)
Parameters
errorProblemDetailErrorThe error to wrap.
Returns
- Result