File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
src/JsonApiDotNetCore/Internal Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -4,28 +4,34 @@ namespace JsonApiDotNetCore.Internal
44{
55 public class JsonApiException : Exception
66 {
7- private string _statusCode ;
8- private string _detail ;
9- private string _message ;
7+ private ErrorCollection _errors = new ErrorCollection ( ) ;
8+
9+ public JsonApiException ( ErrorCollection errorCollection )
10+ {
11+ _errors = errorCollection ;
12+ }
13+
14+ public JsonApiException ( Error error )
15+ : base ( error . Title )
16+ {
17+ _errors . Add ( error ) ;
18+ }
1019
1120 public JsonApiException ( string statusCode , string message )
1221 : base ( message )
1322 {
14- _statusCode = statusCode ;
15- _message = message ;
23+ _errors . Add ( new Error ( statusCode , message , null ) ) ;
1624 }
1725
1826 public JsonApiException ( string statusCode , string message , string detail )
1927 : base ( message )
2028 {
21- _statusCode = statusCode ;
22- _message = message ;
23- _detail = detail ;
29+ _errors . Add ( new Error ( statusCode , message , detail ) ) ;
2430 }
2531
26- public Error GetError ( )
32+ public ErrorCollection GetError ( )
2733 {
28- return new Error ( _statusCode , _message , _detail ) ;
34+ return _errors ;
2935 }
3036 }
3137}
You can’t perform that action at this time.
0 commit comments