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
4
4
{
5
5
public class JsonApiException : Exception
6
6
{
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
+ }
10
19
11
20
public JsonApiException ( string statusCode , string message )
12
21
: base ( message )
13
22
{
14
- _statusCode = statusCode ;
15
- _message = message ;
23
+ _errors . Add ( new Error ( statusCode , message , null ) ) ;
16
24
}
17
25
18
26
public JsonApiException ( string statusCode , string message , string detail )
19
27
: base ( message )
20
28
{
21
- _statusCode = statusCode ;
22
- _message = message ;
23
- _detail = detail ;
29
+ _errors . Add ( new Error ( statusCode , message , detail ) ) ;
24
30
}
25
31
26
- public Error GetError ( )
32
+ public ErrorCollection GetError ( )
27
33
{
28
- return new Error ( _statusCode , _message , _detail ) ;
34
+ return _errors ;
29
35
}
30
36
}
31
37
}
You can’t perform that action at this time.
0 commit comments