John Bachir John Bachir - 5 months ago 17x
Ruby Question

What is a conventional place to keep custom Exception definitions in a rails project?

When making one's own custom exceptions like

class ThingExploded < StandardError; end
class ThingIsMissing < StandardError; end

Where is a good place to keep these? I was considering lib/exceptions.rb… and also pondering if it would be more appropriate to somehow put them closer to the code that uses them.


I'm going with app/models/model_name/exceptions.rb, keeping them inside the module.