RedisQueue 异常无法捕捉?

JackDx

问题描述

这里详细描述问题

程序代码

下面放在外面无法捕获,直接显示报错信息了

try {
    $config = \config('cache.stores.redis');
    $client = new Client($config['type'] . '://' . $config['host'] . ':' . $config['port'], ['auth' => $config['password']]);
    // 订阅
    $client->subscribe('video', function ($data) {
    event('videoClip', $data);
    });
} catch (\Throwable $e) {
    log_error($e, '【视频剪辑定时任务】【videoClip】', 'command_video');
}

下面放在里面正常可以捕获并且写入日记了

$config = \config('cache.stores.redis');
$client = new Client($config['type'] . '://' . $config['host'] . ':' . $config['port'], ['auth' => $config['password']]);
// 订阅
$client->subscribe('video', function ($data) {
    try {
        event('videoClip', $data);
    } catch (\Throwable $e) {
        log_error($e, '【视频剪辑定时任务】【videoClip】', 'command_video');
    }
});

操作系统及workerman/webman等框架组件具体版本

window10
workerman和Workerman\RedisQueue都是最新版

247 1 0
1个回答

walkor

第一段代码在运行完try catch的时候还没执行video的回调,不会捕捉video回调里的异常

  • JackDx 2023-12-27

    了解,感谢老大的回复!!!!

🔝