Table of Contents

Interface IApiErrorWriter

Namespace
Olve.TypeSpec
Assembly
Olve.TypeSpec.dll

Writes the errors the runtime itself answers with, before a handler runs: a request-binding failure (malformed JSON, limit=abc, a missing required parameter) or a failed request validation. The service registers one implementation, so every API keeps its own error body; a typical implementation answers the body only when the matched operation declares the status (Declares(int)) and the bare status otherwise.

public interface IApiErrorWriter

Methods

InvalidRequest(IReadOnlyList<ResultProblem>, int, ApiOperation?)

Answers an invalid request with status (400 unless the framework says otherwise), explaining it with problems.

IResult InvalidRequest(IReadOnlyList<ResultProblem> problems, int status, ApiOperation? operation)

Parameters

problems IReadOnlyList<ResultProblem>

What is wrong; never empty.

status int

The status to answer with.

operation ApiOperation

The matched operation, or null when the request matched none.

Returns

IResult