title: Can't access custom Exception attribute
body: <p>I've got a custom Exception class declared like so:</p>
  
  <pre><code>class CustomError &lt; StandardError
    def initialize(message = nil)
      @message = message
      @type = "custom_error"
    end
  end
  </code></pre>
  
  <p>That is being handled in my Application controller like so:</p>
  
  <pre><code>rescue_from CustomError do |e|
    render json: e.type
  end
  </code></pre>
  
  <p>Now, when I raise the Exception using <code>raise CustomError.new("Oops I did it again")</code> I get a <code>NoMethodError</code> with <em>undefined method `type'</em></p>
  
  <p>What's going on? Why can't I just access <code>type</code> using <code>e.type</code>?</p>