test
Форк от lirfrnk/test
1package com.bittercode.model;
2
3import java.io.IOException;
4
5import com.bittercode.constant.ResponseCode;
6
7public class StoreException extends IOException {
8
9private String errorCode;
10private String errorMessage;
11private int statusCode;
12
13public StoreException(String errorMessage) {
14super(errorMessage);
15this.errorCode = "BAD_REQUEST";
16this.setStatusCode(400);
17this.errorMessage = errorMessage;
18}
19
20public StoreException(ResponseCode errorCodes) {
21super(errorCodes.getMessage());
22this.statusCode = errorCodes.getCode();
23this.errorMessage = errorCodes.getMessage();
24this.setErrorCode(errorCodes.name());
25}
26
27public StoreException(String errroCode, String errorMessage) {
28super(errorMessage);
29this.errorCode = errroCode;
30this.errorMessage = errorMessage;
31this.statusCode = 422;
32}
33
34public StoreException(int statusCode, String errorCode, String errorMessage) {
35super(errorMessage);
36this.statusCode = statusCode;
37this.errorCode = errorCode;
38this.errorMessage = errorMessage;
39}
40
41public String getErrorCode() {
42return errorCode;
43}
44
45public void setErrorCode(String errorCode) {
46this.errorCode = errorCode;
47}
48
49public String getErrorMessage() {
50return errorMessage;
51}
52
53public void setErrorMessage(String errorMessage) {
54this.errorMessage = errorMessage;
55}
56
57public int getStatusCode() {
58return statusCode;
59}
60
61public void setStatusCode(int statusCode) {
62this.statusCode = statusCode;
63}
64
65}
66