Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何将自定义字符串和值传递给Rails中的ExceptionNotifier?_Ruby On Rails_Exception Handling - Fatal编程技术网

Ruby on rails 如何将自定义字符串和值传递给Rails中的ExceptionNotifier?

Ruby on rails 如何将自定义字符串和值传递给Rails中的ExceptionNotifier?,ruby-on-rails,exception-handling,Ruby On Rails,Exception Handling,在从异常中营救时,我有以下代码: rescue Exceptions::LogoNotCroppable => ex logger.error "Logo was not croppable LogoID: #{self.id}. Exception message: #{ex.message}" ex.backtrace.each { |line| logger.debug line } # Send email with notification that somethin

在从异常中营救时,我有以下代码:

rescue Exceptions::LogoNotCroppable => ex
  logger.error "Logo was not croppable LogoID: #{self.id}. Exception message: #{ex.message}"
  ex.backtrace.each { |line| logger.debug line }
  # Send email with notification that something did not go as expected
  ExceptionNotifier.notify_exception(ex)
但是,如果我想传递通知之外的内容,我该怎么做呢?例如,如果要使用数据哈希传递创建异常的对象的self.id?

ExceptionNotifier.notify_exception(ex, :data => {:object_id => self.id})