-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refine 409 Problem Details (RFC 9457) error messages Added
- Loading branch information
1 parent
4b5d6f2
commit de55a5f
Showing
20 changed files
with
204 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
Application/EdFi.Ods.Common/Exceptions/InvalidReferenceConflictException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Licensed to the Ed-Fi Alliance under one or more agreements. | ||
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
// See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace EdFi.Ods.Common.Exceptions; | ||
|
||
public class InvalidReferenceConflictException : ConflictException | ||
{ | ||
// Fields containing override values for Problem Details | ||
private const string TypePart = "invalid-reference"; | ||
private const string TitleText = "Resource Not Unique Conflict due to invalid-reference"; | ||
private const int StatusValue = StatusCodes.Status409Conflict; | ||
|
||
public InvalidReferenceConflictException(string detail) | ||
: base(detail) { } | ||
|
||
public InvalidReferenceConflictException(string detail, Exception innerException) | ||
: base(detail, innerException) { } | ||
|
||
|
||
public InvalidReferenceConflictException(string detail, string[] errors) | ||
: base(detail) | ||
{ | ||
((IEdFiProblemDetails)this).Errors = errors; | ||
} | ||
// --------------------------- | ||
// Boilerplate for overrides | ||
// --------------------------- | ||
public override string Title { get => TitleText; } | ||
|
||
public override int Status { get => StatusValue; } | ||
|
||
protected override IEnumerable<string> GetTypeParts() | ||
{ | ||
foreach (var part in base.GetTypeParts()) | ||
{ | ||
yield return part; | ||
} | ||
|
||
yield return TypePart; | ||
} | ||
// --------------------------- | ||
} |
48 changes: 48 additions & 0 deletions
48
Application/EdFi.Ods.Common/Exceptions/NaturalKeyConflictException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Licensed to the Ed-Fi Alliance under one or more agreements. | ||
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
// See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace EdFi.Ods.Common.Exceptions; | ||
|
||
public class NaturalKeyConflictException : ConflictException | ||
{ | ||
// Fields containing override values for Problem Details | ||
private const string TypePart = "natural-key"; | ||
private const string TitleText = "Resource Not Unique Conflict due to natural-key"; | ||
private const int StatusValue = StatusCodes.Status409Conflict; | ||
|
||
public NaturalKeyConflictException(string detail) | ||
: base(detail) { } | ||
|
||
public NaturalKeyConflictException(string detail, Exception innerException) | ||
: base(detail, innerException) { } | ||
|
||
|
||
public NaturalKeyConflictException(string detail, string[] errors) | ||
: base(detail) | ||
{ | ||
((IEdFiProblemDetails)this).Errors = errors; | ||
} | ||
// --------------------------- | ||
// Boilerplate for overrides | ||
// --------------------------- | ||
public override string Title { get => TitleText; } | ||
|
||
public override int Status { get => StatusValue; } | ||
|
||
protected override IEnumerable<string> GetTypeParts() | ||
{ | ||
foreach (var part in base.GetTypeParts()) | ||
{ | ||
yield return part; | ||
} | ||
|
||
yield return TypePart; | ||
} | ||
// --------------------------- | ||
} |
48 changes: 48 additions & 0 deletions
48
Application/EdFi.Ods.Common/Exceptions/NonUniqueConflictException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Licensed to the Ed-Fi Alliance under one or more agreements. | ||
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
// See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace EdFi.Ods.Common.Exceptions; | ||
|
||
public class NonUniqueConflictException : ConflictException | ||
{ | ||
// Fields containing override values for Problem Details | ||
private const string TypePart = "not-unique"; | ||
private const string TitleText = "Resource Not Unique Conflict Due to Not-Unique"; | ||
private const int StatusValue = StatusCodes.Status409Conflict; | ||
|
||
public NonUniqueConflictException(string detail) | ||
: base(detail) { } | ||
|
||
public NonUniqueConflictException(string detail, Exception innerException) | ||
: base(detail, innerException) { } | ||
|
||
|
||
public NonUniqueConflictException(string detail, string[] errors) | ||
: base(detail) | ||
{ | ||
((IEdFiProblemDetails)this).Errors = errors; | ||
} | ||
// --------------------------- | ||
// Boilerplate for overrides | ||
// --------------------------- | ||
public override string Title { get => TitleText; } | ||
|
||
public override int Status { get => StatusValue; } | ||
|
||
protected override IEnumerable<string> GetTypeParts() | ||
{ | ||
foreach (var part in base.GetTypeParts()) | ||
{ | ||
yield return part; | ||
} | ||
|
||
yield return TypePart; | ||
} | ||
// --------------------------- | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.