* 获取错误消息 * @param {Error} error - 错误对象 * @param {string} context - 错误上下文 * @returns {string} 错误消息
(error, context)
| 51 | * @returns {string} 错误消息 |
| 52 | */ |
| 53 | static getErrorMessage(error, context) { |
| 54 | if (error?.message) { |
| 55 | return `${context}失败: ${error.message}` |
| 56 | } |
| 57 | return `${context}失败` |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * 处理网络请求错误 |