Reference
Error codes
Every Error code the Kit declares, its kind, its message and when it is returned.
The Errors the Kit fails an Operation with, by package. The kind decides the HTTP status (see problem responses); a code constant names the Errors a validation returns, each with its own message.
PouryaKit.Cqrs
| Code | Kind | Message | When |
|---|---|---|---|
Operation.CommandThrew | Unexpected | A command failed with an exception, so the Operation was rolled back. | A command inside the Operation threw, so the Operation was rolled back, even when the code that sent the command handled the exception. The Error carries no exception text. |
Operation.ReadingChangedState | Unexpected | Code that only reads changed tracked state, so the Operation was rolled back. | Code that only reads, such as a query, an authorizer, a validator or a step opened with Operation.OnlyReading(string), changed tracked state, so the Operation was rolled back. |
Page.DirectionUnknown | The direction is neither ascending nor descending; the target is Direction. | ||
Page.FilterOperatorUnsupported | The field does not declare the filter's operator; the target is the filter. | ||
Page.FilterRepeated | A field and operator are given twice; the target is the second filter. | ||
Page.FilterUnknown | The filter's field is not declared; the target is the filter, Filters[i]. | ||
Page.FilterValueInvalid | The filter's value is not of the field's type; the target is the filter. | ||
Page.NumberOutOfRange | The number is below 1 or past the last Page an offset can reach; the target is Number. | ||
Page.SizeOutOfRange | The size is outside 1 to the declared maximum; the target is Size. | ||
Page.SortUnknown | The sort key is not declared; the target is Sort. | ||
Tenant.Mismatch | Forbidden | This operation changes data of another tenant than its own, or moves data between tenants, so nothing was saved. | The Operation would save a tenant-scoped aggregate that is not its tenant's: one it added for another tenant, or one it changed or removed that belonged to another tenant when it was loaded, or whose tenant it changed. Nothing was saved. |
Tenant.NotLoaded | Forbidden | This operation changes tenant data it did not load, so nothing was saved. | The Operation would save a change to a tenant-scoped aggregate, or to a part of one, that it attached instead of loading it through a query: a tenant-scoped aggregate is loaded, never attached, since an attached entity's key may name another tenant's row. Nothing was saved. |
Tenant.Required | Forbidden | This operation runs only for a tenant, and its context names none. | The Operation has no tenant, and every Operation of its Module needs one. Nothing ran. |
PouryaKit.Email
| Code | Kind | Message | When |
|---|---|---|---|
Email.InvalidAddress | Validation | The recipient is not one mailbox address with a domain, such as ada@example.com. | The message's recipient is not one mailbox address with a domain. Nothing was sent. |
PouryaKit.Persistence
| Code | Kind | Message | When |
|---|---|---|---|
UnitOfWork.ConcurrencyConflict | Conflict | Another operation changed the same data first, so nothing was saved. | Another Operation committed a change to an aggregate this Operation changed, after this one read it; or the Operation wrote an aggregate it attached rather than loaded, whose stored row has another version or no longer exists; or, in PouryaKit.Persistence.Postgres, PostgreSQL ended a deadlock by aborting this Operation's wait for a number sequence; or, in PouryaKit.Persistence.Marten, another Operation appended to a Stream this Operation changed after this one read it, or started a Stream this Operation started too. Nothing was committed; the caller decides whether to run the Operation again, in a new scope. |
PouryaKit.Realtime
| Code | Kind | Message | When |
|---|---|---|---|
Realtime.ChannelNotAdmitted | Forbidden | The caller may not listen on a channel the request names. | The endpoint's rule does not admit the caller to a Channel the request names. No connection was opened. |
Realtime.ChannelRequired | Validation | Name at least one channel to listen on, with the channel query parameter. | The request names no Channel to listen on, or a blank one. No connection was opened. |
Realtime.PayloadTooLarge | Validation | The realtime event, with its channel and tenant, is 8000 bytes or more, which PostgreSQL does not carry. Push a small fact or a reference, and let the client read the rest through a query. | The push's notification, its Channel, tenant and event in the Kit's JSON, is 8000 bytes or more, which PostgreSQL does not carry. Nothing was pushed. |
PouryaKit.Reporting
| Code | Kind | Message | When |
|---|---|---|---|
Reporting.LogoFormat | Validation | The report's logo is not a readable PNG or JPEG image. | The branding's logo is not a PNG or JPEG image PDFsharp can load, such as another format or a file cut short; a PDF draws those two formats only. |
Reporting.TableShape | Validation | The report's table has no column, or a row whose number of cells differs from its number of columns. | The layout's table has no column, or a row whose number of cells differs from its number of columns. |
PouryaKit.Reporting.Module
| Code | Kind | Message | When |
|---|---|---|---|
Reports.JobNotFound | NotFound | The report job does not exist. | |
Reports.RequestDenied | Forbidden | This report may not be requested with these parameters. |
PouryaKit.Security
| Code | Kind | Message | When |
|---|---|---|---|
Permission.Denied | Forbidden | This operation requires a permission its actor does not hold. | The Actor does not hold the permission the command or query declares. Nothing ran. |
PouryaKit.Storage
| Code | Kind | Message | When |
|---|---|---|---|
Storage.FileNotFound | NotFound | No file is stored under this key. | No file is stored under the key the call names. |
Storage.LinkLifetimeOutOfRange | Validation | The link's lifetime is zero or less, or longer than the {maximum} the file storage provider signs a link for. | A presigned link's lifetime is zero or less, or longer than the provider signs a link for: S3 and Azure Blob each sign one for at most seven days. No link was signed. |
PouryaKit.Validation
| Code | Kind | Message | When |
|---|---|---|---|
Validation.Failed | The code of a validation failure that carries no error code of its own. |