Skip to content

Commit 9ed006f

Browse files
committed
readme
1 parent 6326ce1 commit 9ed006f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## flylib-boot简介
2-
flylib-boot是针对springboot构建的程序的基础框架,专门用于构建程序里的比如统一
2+
flylib-boot是针对springboot构建的程序的基础框架,专门用于构建程序里的比如统一
33
异常处理
44

55
## 功能
@@ -69,3 +69,20 @@ flylib-boot是针对springboot构建的程序的基础框架,专门用于构
6969
</project>
7070
7171
```
72+
73+
捕获异常的实例
74+
```
75+
@RequestMapping("")
76+
public String index() throws RuntimeException {
77+
UserException userException = new UserException();
78+
CustomRuntimeException cause = new CustomRuntimeException("001", "User not exists");
79+
userException.initCause(cause);
80+
throw userException;
81+
}
82+
```
83+
输出到浏览器的结果
84+
```
85+
code:"001"
86+
message:"User not exists"
87+
throwable:{...}
88+
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy