* 处理异步操作错误 * @param {Function} asyncFn - 异步函数 * @param {string} context - 错误上下文 * @param {Object} options - 配置选项
(asyncFn, context, options = {})
| 118 | * @param {Object} options - 配置选项 |
| 119 | */ |
| 120 | static async handleAsync(asyncFn, context, options = {}) { |
| 121 | try { |
| 122 | return await asyncFn() |
| 123 | } catch (error) { |
| 124 | this.handleError(error, context, options) |
| 125 | throw error |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * 创建错误处理装饰器 |
nothing calls this directly
no test coverage detected