@@ -9,12 +9,100 @@ repositories {
9
9
}
10
10
11
11
dependencies {
12
- implementation(" com.github.merge-simpson:letsdev-error-code-api:0.1 .0" ) // added
12
+ implementation(" com.github.merge-simpson:letsdev-error-code-api:0.2 .0" ) // added
13
13
}
14
14
```
15
15
16
16
# Features
17
17
18
+ ## Pure Java Error Code
19
+
20
+ - ` BaseErrorCode ` ` <<interface>> `
21
+ - ` BaseCustomException ` ` <<exception>> `
22
+
23
+ ``` mermaid
24
+ %%{init: {"theme": "forest", "themeVariables": {"fontFamily": "Comic Sans MS"}}}%%
25
+ classDiagram
26
+ %% 클래스 목록
27
+ class BaseErrorCode {
28
+ <<interface>>
29
+ +name() String
30
+ +message() String
31
+ +statusCode() int
32
+ +exception() RuntimeException
33
+ +exception(Throwable cause) RuntimeException
34
+ +exception(Runnable action) RuntimeException
35
+ +exception(Runnable action, Throwable cause) RuntimeException
36
+ +exception(Supplier<Map<String,Object>> payloadSupplier) RuntimeException
37
+ +exception(Supplier<Map<String,Object>> payloadSupplier, Throwable cause) RuntimeException
38
+ }
39
+
40
+ class BaseCustomException {
41
+ #errorCode: BaseErrorCode
42
+ #action: Runnable
43
+ #payloadSupplier: Supplier<Map<String,Object>>
44
+
45
+ +BaseCustomException()
46
+ +BaseCustomException(message: String)
47
+ +BaseCustomException(message: String, cause: Throwable)
48
+ +BaseCustomException(errorCode: BaseErrorCode)
49
+ +BaseCustomException(errorCode: BaseErrorCode, cause: Throwable)
50
+ +BaseCustomException(errorCode: BaseErrorCode, action: Runnable)
51
+ +BaseCustomException(errorCode: BaseErrorCode, action: Runnable, cause: Throwable)
52
+ +BaseCustomException(errorCode: BaseErrorCode, payloadSupplier: Supplier<Map<String,Object>>)
53
+ +BaseCustomException(errorCode: BaseErrorCode, payloadSupplier: Supplier<Map<String,Object>>, cause: Throwable)
54
+
55
+ +getErrorCode() : BaseErrorCode
56
+ -(static) getDefaultErrorCode() : BaseErrorCode
57
+ }
58
+
59
+ class DefaultBaseErrorCodeHolder {
60
+ <<private>>
61
+ -INSTANCE : BaseErrorCode
62
+ }
63
+
64
+ %% 관계 표현
65
+ BaseCustomException ..> BaseErrorCode : uses
66
+ BaseCustomException o-- DefaultBaseErrorCodeHolder : contains
67
+ ```
68
+
69
+ ## Spring-Dependent Error Code
70
+
71
+ - ` ErrorCode ` : ` <<interface>> `
72
+ - ` CustomException ` ` <<exception>> `
73
+
74
+ ** Usage**
75
+
76
+ ``` mermaid
77
+ %%{init: {"theme": "forest", "themeVariables": {"fontFamily": "Comic Sans MS"}}}%%
78
+ classDiagram
79
+ %% 클래스 목록
80
+ class BaseErrorCode {
81
+ <<interface>>
82
+ }
83
+
84
+ class BaseCustomException {
85
+ <<exception>>
86
+ }
87
+
88
+ class ErrorCode {
89
+ <<interface>>
90
+ +httpStatus() HttpStatus
91
+ }
92
+
93
+ class CustomException {
94
+ <<exception>>
95
+ }
96
+
97
+ %% 관계 표현
98
+ %% ErrorCode ..|> BaseErrorCode
99
+ %% CustomException --|> BaseCustomException
100
+ BaseCustomException ..> BaseErrorCode : uses
101
+ CustomException ..> ErrorCode : uses
102
+ ```
103
+
104
+ <!--
105
+
18
106
## 확장 가능한 Error Code
19
107
20
108
- \<\<interface\>\> `ErrorCode` (Spring-dependent)
@@ -61,3 +149,5 @@ public final class GlobalExceptionHandler {
61
149
| Group | Artifact ID |
62
150
|:-------------------:|:-----------:|
63
151
| org.springframework | spring-web |
152
+
153
+ -->
0 commit comments