Jforum:向用户显示自定义异常消息

时间:2014-09-18 12:49:59

标签: java jsp exception

我正在使用jforum2,但它显示错误

An error has occurred.

For detailed error information, please see the HTML source code, and contact the forum Administrator.

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure

The last packet successfully received from the server was 2,989,022 milliseconds ago.  The last packet sent successfully to the server was 6 milliseconds ago.

Query being executed when exception was thrown:
SELECT COUNT(pm.privmsgs_to_userid) AS private_messages, u.* FROM jforum_users u LEFT JOIN jforum_privmsgs pm ON pm.privmsgs_type = 1 AND pm.privmsgs_to_userid = u.user_id WHERE u.user_id = 1 GROUP BY pm.privmsgs_to_userid

虽然我想向用户显示自定义错误消息,但我必须更改以显示自定义错误消息而不是上述消息给论坛用户?

1 个答案:

答案 0 :(得分:0)

而不是重新抛出Exception,你可能想要抓住它并使用你喜欢的消息。