I have a rails app in heroku. The values are passed to the server and it works correctly and sometimes it displays an error like
<!DOCTYPE html> <html> <head> <title>We're sorry, but something went wrong (500)</title> <style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; } </style> </head>
<body> <!-- This file lives in public/500.html --> <div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>We've been notified about this issue and we'll take a look at it shortly.</p> </div> </body> </html>
so i do not want to get these errors as such. Instead i want to get those error and display something like unexpected error in json to the app. How can i do this? Please help me.
Add the following code in application_controller.rb
Similarly you can add all Exceptions you need in rescue_from method