File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/JsonApiDotNetCore/Controllers Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1+ using System . Collections . Generic ;
12using System . Linq ;
23using JsonApiDotNetCore . Internal ;
34using Microsoft . AspNetCore . Mvc ;
@@ -16,6 +17,17 @@ protected IActionResult Forbidden()
1617 return new StatusCodeResult ( 403 ) ;
1718 }
1819
20+ protected IActionResult Error ( Error error )
21+ {
22+ var errorCollection = new ErrorCollection {
23+ Errors = new List < Error > { error }
24+ } ;
25+ var result = new ObjectResult ( errorCollection ) ;
26+ result . StatusCode = error . StatusCode ;
27+
28+ return result ;
29+ }
30+
1931 protected IActionResult Errors ( ErrorCollection errors )
2032 {
2133 var result = new ObjectResult ( errors ) ;
@@ -27,7 +39,7 @@ protected IActionResult Errors(ErrorCollection errors)
2739 private int GetErrorStatusCode ( ErrorCollection errors )
2840 {
2941 var statusCodes = errors . Errors
30- . Select ( e => ( int ) e . StatusCode )
42+ . Select ( e => e . StatusCode )
3143 . Distinct ( )
3244 . ToList ( ) ;
3345
You can’t perform that action at this time.
0 commit comments