Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/65.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异常通知_Ruby On Rails_Ruby On Rails 3 - Fatal编程技术网

Ruby on rails 无中间件的Rails异常通知

Ruby on rails 无中间件的Rails异常通知,ruby-on-rails,ruby-on-rails-3,Ruby On Rails,Ruby On Rails 3,我有一个Rails 4应用程序,它完全由从gem生成的cron上的Rails运行程序组成 如果在运行期间出现任何异常,我希望得到通知。gem仅作为机架中间件运行(仅限web请求),因此它不处理rails运行程序 有什么想法吗?我希望通过电子邮件或闲暇时间得到通知。您可以使用异常通知程序。在救援区块中通知\u异常以发送通知 例如: def rescue_exception(data) yield rescue => e ExceptionNotifier.notify_excepti

我有一个Rails 4应用程序,它完全由从gem生成的cron上的Rails运行程序组成

如果在运行期间出现任何异常,我希望得到通知。gem仅作为机架中间件运行(仅限web请求),因此它不处理rails运行程序


有什么想法吗?我希望通过电子邮件或闲暇时间得到通知。

您可以使用
异常通知程序。在救援区块中通知\u异常
以发送通知

例如:

def rescue_exception(data)
  yield
rescue => e
  ExceptionNotifier.notify_exception(e, data: data)
end

every :hour do
  rescue_exception(runner: 'SomeModel.some_method') do
    runner "SomeModel.some_method"
  end
end

请参阅。使用
数据
散列传递有关上下文的附加信息。

您可以使用救援块中的
异常通知程序。通知\u异常
发送通知

例如:

def rescue_exception(data)
  yield
rescue => e
  ExceptionNotifier.notify_exception(e, data: data)
end

every :hour do
  rescue_exception(runner: 'SomeModel.some_method') do
    runner "SomeModel.some_method"
  end
end

请参阅。使用
数据
散列传递有关上下文的附加信息。

您可以使用救援块中的
异常通知程序。通知\u异常
发送通知

例如:

def rescue_exception(data)
  yield
rescue => e
  ExceptionNotifier.notify_exception(e, data: data)
end

every :hour do
  rescue_exception(runner: 'SomeModel.some_method') do
    runner "SomeModel.some_method"
  end
end

请参阅。使用
数据
散列传递有关上下文的附加信息。

您可以使用救援块中的
异常通知程序。通知\u异常
发送通知

例如:

def rescue_exception(data)
  yield
rescue => e
  ExceptionNotifier.notify_exception(e, data: data)
end

every :hour do
  rescue_exception(runner: 'SomeModel.some_method') do
    runner "SomeModel.some_method"
  end
end

请参阅。使用
data
hash传递有关上下文的附加信息。

是否有这样做的方法,以便您不必为每项工作都这样做?是否有这样做的方法,以便您不必为每项工作都这样做?是否有这样做的方法,以便您不必为每项工作都这样做?是否有这样做的方法,以便您不必为每项工作都这样做为每一项工作都这么做?