I am trying to create custom exceptions for my application. I have a sample library in the libs folder with the following folder structure:
- lib/
|
|--social/
|
|-- bandcamp.rb
And this content is bandcamp.rbas follows:
module Social
class ExampleException < Exception; end
class Bandcamp
def some_method()
end
end
end
And the whole point is that I can use Social::Bandcamp.new.some_methodanywhere in my application, and it works fine, but I can’t access it Social::ExampleExceptionand never raise it anywhere. It gives me
NameError: uninitialized constant Social::ExampleException
Do you have any ideas what I can do wrong? I am completely new to creating my own libraries, so I’m sure that something did not understand.
source
share