Table of Contents

Class ProblemDetailError

Namespace
Arc4u.Results
Assembly
Arc4u.Results.dll

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
Error
ProblemDetailError
Implements
IError
IReason
Inherited Members
Error.CausedBy(IError)
Error.ToString()
Error.Message
Error.Metadata
Error.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

string

Severity

Gets the severity exposed as an extension of the ProblemDetails, or null when not set.

public string? Severity { get; }

Property Value

string

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

string

Type

Gets the URI identifying the problem type (the type member), or null when not set.

public Uri? Type { get; }

Property Value

Uri

Methods

Create(string)

Creates a ProblemDetailError whose FluentResults.Error.Message is the detail of the problem.

public static ProblemDetailError Create(string detail)

Parameters

detail string

The human readable explanation, used as the detail member 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

instance string

The 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

key string

The metadata key.

value object

The metadata value.

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

severity string

The severity, for example the name of a Severity value.

Returns

ProblemDetailError

This error, to chain calls.

WithStatusCode(int)

Sets the HTTP status code of the problem.

public ProblemDetailError WithStatusCode(int statusCode)

Parameters

statusCode int

The 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

title string

The title.

Returns

ProblemDetailError

This error, to chain calls.

WithType(Uri)

Sets the URI identifying the problem type.

public ProblemDetailError WithType(Uri type)

Parameters

type Uri

The 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

error ProblemDetailError

The error to wrap.

Returns

Result