We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e332d57 commit 999a933Copy full SHA for 999a933
1 file changed
src/main/java/top/cadecode/simple/common/response/SimpleRes.java
@@ -34,9 +34,15 @@ public class SimpleRes {
34
*/
35
@Data
36
@AllArgsConstructor
37
+ @NoArgsConstructor
38
public static class ResError {
39
private Integer code;
40
private String reason;
41
+
42
+ public ResError(ErrorEnum errorEnum){
43
+ this.code = errorEnum.getCode();
44
+ this.reason = errorEnum.getReason();
45
+ }
46
}
47
48
/**
@@ -63,7 +69,7 @@ public static SimpleRes fail(ErrorEnum errorEnum) {
63
69
SimpleRes res = new SimpleRes();
64
70
res.setStatus(errorEnum.getStatusEnum().getStatus());
65
71
res.setMessage(errorEnum.getStatusEnum().getMessage());
66
- res.setError(new ResError(errorEnum.getCode(), errorEnum.getReason()));
72
+ res.setError(new ResError(errorEnum));
67
73
return res;
68
74
75
0 commit comments