Question: I've come across this pattern a few times, but am not sure what it is, or how to Google it.

```
class ApiController < ApplicationController
  class InvalidAppToken < RuntimeError ; end
  class InvalidUserToken < RuntimeError ; end
  ...
end

```

Answer: 
It creates custom errors. Doing this you can raise your personalized errors, then rescue them to better handle the app errors.

```
class MyController < ApiController
  begin
    unless DoSomething(params[:user_token])
      raise InvalidUserToken
      [...]
    end
  rescue InvalidUserToken
    # manage this error
  end
end

```
It simply defines custom types of errors. Could be useful to raise very specific errors in your workflow.

[Have a look at this book](http://www.goodreads.com/book/show/11799211-exceptional-ruby)