gpt4 book ai didi

ruby - 在 rake 任务中使用 pry-rescue?

转载 作者:数据小太阳 更新时间:2023-10-29 06:54:28 26 4
gpt4 key购买 nike

我正在尝试使用 pry-rescue在 rake 任务中。像这样:

   bundle exec rescue rake my:task

但是当异常发生时(undefined method...)它就像正常一样存在。 如何在我的 rake 任务中使用 pry-rescue?

最佳答案

您是否尝试过将任务主体包裹在救援 block 中?

task 'my_task' do
Pry.rescue {
things.that_need_doing
}
end

关于ruby - 在 rake 任务中使用 pry-rescue?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24194933/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com