title: Rails, custom exceptions
body: <p>I'm following instructions at <a href="http://ariejan.net/2011/10/14/rails-3-customized-exception-handling/" rel="nofollow">http://ariejan.net/2011/10/14/rails-3-customized-exception-handling/</a> and have hit a road block.</p>
  
  <p>I am relatively new to rails, so I'm not sure what I've done right/not-so-right.</p>
  
  <p>The first step was to create class</p>
  
  <pre><code>MyApp::ProfileNotFoundError &lt; StandardError
  end
  </code></pre>
  
  <p>So I went to app/models and created profile_not_found.rb which contains the following, where (APP) is the name of my app as defined by Rails.application.class.parent_name, but I have hidden from this post for security/privacy.</p>
  
  <pre><code>(APP)::ProfileNotFoundError &lt; StandardError
  end
  </code></pre>
  
  <p>In app/controllers/application_controller.rb I added</p>
  
  <pre><code>rescue_from (APP)::ProfileNotFoundError, :with =&gt; :profile_not_found
  </code></pre>
  
  <p>and in my login controller I added</p>
  
  <pre><code>raise (APP)::ProfileNotFoundError if @profile.nil?
  </code></pre>
  
  <p>However, when I try to test the code, I get a Routing Error stating</p>
  
  <pre><code>uninitialized constant (APP)::BlankUsernameError
  </code></pre>
  
  <p>In my opinion, this suggests that I did something wrong pertaining to the class creation, but the tutorial is so vague I can't figure it out.  Any pointers?</p>
  
  <p>I'm running Rails 3.0.20 &amp; Ruby 1.8.7 on Ubuntu 12.04.2 x86_64</p>