Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9ed006f

Browse files
committed
readme
1 parent6326ce1 commit9ed006f

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)

[8]ページ先頭

©2009-2025 Movatter.jp