Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8990175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:26:34+00:00 2026-06-15T22:26:34+00:00

I have a rails app in heroku. The values are passed to the server

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:26:36+00:00Added an answer on June 15, 2026 at 10:26 pm

    Add the following code in application_controller.rb

    rescue_from "ActiveRecord::RecordNotFound" do |exception|
       render :json => {:error => 'page not found' }
    end
    

    Similarly you can add all Exceptions you need in rescue_from method

    rescue_from "Exception" do |exception|
     render :json => {:error => 'Unexpected error occurred' }
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Rails app is hosted on Heroku. I would like to have another server
I have a Rails app on Heroku that works fine when I access it
I have a rails app running a thin server on heroku. It currently uses
I have a ruby on rails app that uses highcharts. Locally it works like
I have a Rails app deployed on Heroku with the Heroku scheduler add-on successfully
I have a Rails app hosted in Heroku. If I go the the site
I have a Rails app running Mongoid on Heroku and I need to set
I have a Rails 3.2 app that I'm deploying on the Heroku Cedar stack.
I have a single-threaded Rails app running on thin in single-threaded mode on Heroku
I have a rails app, where Im having a drop box like feature-set. Each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.