I donβt understand how Rails includes (or not?) Some file from the application directory.
For example, I created a new application / directory exception to create my own exceptions. Now, from the helpers file, I want to raise one of my exceptions.
Can I include something in this helper?
Assistant: assistants / communication _helper.rb
//should I include something or it suppose to be autoloaded? module CommunicationsHelper begin. . . . raise ParamsException, "My exception is lauch!" rescue StandardError => e ... end end
Exception: exceptions / params_exception.rb
class ParamsException < StandardError def initialize(object, operation) puts "Dans paramsException" end end
Nothing concrete from my rise in output ...
Thanks!
EDIT: Thanks to everyone, your answers were useful in many ways. I did not explain the exception very well, as you said, but I also refuse to update my config.rb. so now i:
rescue StandardError => e raise ParamsError.new("truc", "truc")
Another question, do you know where I can catch a raise? Because I'm already in the catch block, so I lost a little ...
source share