You should add the exception class to your app/models folder. Anything that's business logic for your application should be in the app/models folder (as this article talks about in more detail). The lib folder is where you put code that is basically external to your app (almost like the last step before you extract it into a gem some day).
Here is an example exception that you can refer to from anywhere in your app:
# app/models/my_exception.rb
class MyException < RuntimeError
end
And since the app/models folder is already autoloaded you're all set -- no need to require the file in an initializer or anything like that.