Skip to content

Commit ae3ebca

Browse files
committed
Brush up error handling when exception occurred to int
1 parent f7106bd commit ae3ebca

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/scala/gitbucket/monitoring/services/MachineResources.scala

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,16 @@ trait MachineResources {
5353
mem(1),
5454
mem(2),
5555
mem(3),
56-
(mem(4).toInt + mem(5).toInt).toString,
57-
(mem(2).toInt + mem(4).toInt + mem(5).toInt).toString
56+
try {
57+
(mem(4).toInt + mem(5).toInt).toString
58+
} catch {
59+
case e: Exception => Message.error
60+
},
61+
try {
62+
(mem(2).toInt + mem(4).toInt + mem(5).toInt).toString
63+
} catch {
64+
case e: Exception => Message.error
65+
}
5866
))
5967
}
6068
} catch {

0 commit comments

Comments
 (0)