I want to make things failsafe.
If the database server is down, or something goes wrong, TinyTds throws TinyTds::Error. But I can't catch that error. All I want to do is to write log for that and show an error page for user.
I've searched long time but I can't find how.
Problem solved. This is not controller-level issue, and thus, it is obvious that I can't catch an error which is not a controller level.
I've solved with exception_handler
gem. With that gem, I can bypass the stock middleware and customize the behavior when I got TinyTds::Error
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.