3
3
4
4
namespace Exceptionless . Submission {
5
5
public class SubmissionResponse {
6
+ internal static readonly SubmissionResponse Ok200 = new ( 200 , "OK" ) ;
7
+
6
8
public SubmissionResponse ( int statusCode , string message = null , Exception exception = null ) {
7
9
StatusCode = statusCode ;
8
10
Message = message ;
9
11
10
- Success = statusCode >= 200 && statusCode <= 299 ;
11
- BadRequest = ( HttpStatusCode ) statusCode == HttpStatusCode . BadRequest ;
12
- ServiceUnavailable = ( HttpStatusCode ) statusCode == HttpStatusCode . ServiceUnavailable ;
13
- PaymentRequired = ( HttpStatusCode ) statusCode == HttpStatusCode . PaymentRequired ;
14
- UnableToAuthenticate = ( HttpStatusCode ) statusCode == HttpStatusCode . Unauthorized || ( HttpStatusCode ) statusCode == HttpStatusCode . Forbidden ;
15
- NotFound = ( HttpStatusCode ) statusCode == HttpStatusCode . NotFound ;
16
- RequestEntityTooLarge = ( HttpStatusCode ) statusCode == HttpStatusCode . RequestEntityTooLarge ;
17
12
Exception = exception ;
18
13
}
19
14
20
- public bool Success { get ; private set ; }
21
- public bool BadRequest { get ; private set ; }
22
- public bool ServiceUnavailable { get ; private set ; }
23
- public bool PaymentRequired { get ; private set ; }
24
- public bool UnableToAuthenticate { get ; private set ; }
25
- public bool NotFound { get ; private set ; }
26
- public bool RequestEntityTooLarge { get ; private set ; }
15
+ public bool Success => StatusCode >= 200 && StatusCode <= 299 ;
16
+ public bool BadRequest => ( HttpStatusCode ) StatusCode == HttpStatusCode . BadRequest ;
17
+ public bool ServiceUnavailable => ( HttpStatusCode ) StatusCode == HttpStatusCode . ServiceUnavailable ;
18
+ public bool PaymentRequired => ( HttpStatusCode ) StatusCode == HttpStatusCode . PaymentRequired ;
19
+ public bool UnableToAuthenticate => ( HttpStatusCode ) StatusCode == HttpStatusCode . Unauthorized || ( HttpStatusCode ) StatusCode == HttpStatusCode . Forbidden ;
20
+ public bool NotFound => ( HttpStatusCode ) StatusCode == HttpStatusCode . NotFound ;
21
+ public bool RequestEntityTooLarge => ( HttpStatusCode ) StatusCode == HttpStatusCode . RequestEntityTooLarge ;
27
22
28
- public int StatusCode { get ; private set ; }
29
- public string Message { get ; private set ; }
23
+ public int StatusCode { get ; }
24
+ public string Message { get ; }
30
25
31
- public Exception Exception { get ; private set ; }
26
+ public Exception Exception { get ; }
32
27
}
33
28
}
0 commit comments