Skip to content

Commit 978a311

Browse files
author
Bart Koelman
authored
Replaced references to Error in documentation, which was renamed to ErrorObject (#1143)
1 parent e623e84 commit 978a311

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Diff for: docs/usage/errors.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Errors
22

3-
Errors returned will contain only the properties that are set on the `Error` class. Custom fields can be added through `Error.Meta`.
4-
You can create a custom error by throwing a `JsonApiException` (which accepts an `Error` instance), or returning an `Error` instance from an `ActionResult` in a controller.
5-
Please keep in mind that JSON:API requires Title to be a generic message, while Detail should contain information about the specific problem occurence.
3+
Errors returned will contain only the properties that are set on the `ErrorObject` class. Custom fields can be added through `ErrorObject.Meta`.
4+
You can create a custom error by throwing a `JsonApiException` (which accepts an `ErrorObject` instance), or returning an `ErrorObject` instance from an `ActionResult` in a controller.
5+
Please keep in mind that JSON:API requires `Title` to be a generic message, while `Detail` should contain information about the specific problem occurence.
66

77
From a controller method:
88

99
```c#
10-
return Conflict(new Error(HttpStatusCode.Conflict)
10+
return Conflict(new ErrorObject(HttpStatusCode.Conflict)
1111
{
1212
Title = "Target resource was modified by another user.",
1313
Detail = $"User {userName} changed the {resourceField} field on {resourceName} resource."
@@ -17,7 +17,7 @@ return Conflict(new Error(HttpStatusCode.Conflict)
1717
From other code:
1818

1919
```c#
20-
throw new JsonApiException(new Error(HttpStatusCode.Conflict)
20+
throw new JsonApiException(new ErrorObject(HttpStatusCode.Conflict)
2121
{
2222
Title = "Target resource was modified by another user.",
2323
Detail = $"User {userName} changed the {resourceField} field on {resourceName} resource."
@@ -75,7 +75,7 @@ public class CustomExceptionHandler : ExceptionHandler
7575
{
7676
return new[]
7777
{
78-
new Error(HttpStatusCode.Conflict)
78+
new ErrorObject(HttpStatusCode.Conflict)
7979
{
8080
Title = "Product is temporarily available.",
8181
Detail = $"Product {productOutOfStock.ProductId} " +

Diff for: docs/usage/extensibility/resource-definitions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public class EmployeeDefinition : JsonApiResourceDefinition<Employee, int>
200200
if (existingIncludes.Any(include =>
201201
include.Relationship.Property.Name == nameof(Employee.Manager)))
202202
{
203-
throw new JsonApiException(new Error(HttpStatusCode.BadRequest)
203+
throw new JsonApiException(new ErrorObject(HttpStatusCode.BadRequest)
204204
{
205205
Title = "Including the manager of employees is not permitted."
206206
});

0 commit comments

Comments
 (0)