I don't understand well how Rails include (or not?) some file from the app directory.
For example, I've created a new directory app/exceptions for create my own exceptions. Now, from a helpers file, I want to raise one of my exception.
Am I suppose to include something in this helper?
The Helper: helpers/communications_helper.rb
//should I include something or it's suppose to be autoloaded?
module CommunicationsHelper
begin.
.
.
.
raise ParamsException, "My exception is lauch!"
rescue StandardError => e
...
end
end
The exception: exceptions/params_exception.rb
class ParamsException < StandardError
def initialize(object, operation)
puts "Dans paramsException"
end
end
Nothing specific from my raise in the output...
Thanks!
EDIT: Thanks to all, your two answers was helpful in different way. I didn't raise well the exception like you said, but I've also forggot to update my config.rb. so now I 've:
rescue StandardError => e
raise ParamsError.new("truc", "truc")
Other question, do you know where can I catch the raise? Cause I'm already in a catch block, so I'm little lost...