From 4038b7d0b936f3c70ff399442011b08258ef1751 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 31 May 2026 11:56:46 +0800 Subject: [PATCH] fix: gen_sms_code.dspy catch exception and return actual error message --- wwwroot/gen_sms_code.dspy | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wwwroot/gen_sms_code.dspy b/wwwroot/gen_sms_code.dspy index 94c606f..7177cce 100644 --- a/wwwroot/gen_sms_code.dspy +++ b/wwwroot/gen_sms_code.dspy @@ -7,12 +7,15 @@ if phone is None: } } # 使用短信模块发布的sms_engine实例生成验证码,参数手机号 -xx = await sms_engine.generate_sms_code(phone) -if xx is None: +try: + xx = await sms_engine.generate_sms_code(phone) +except Exception as e: + debug(f'gen_sms_code error: {e}') + exception(f'gen_sms_code error for {phone}: {e}') return { "status": "error", "data": { - "message": "发送验证码出错" + "message": f"发送验证码出错: {e}" } } id, code = xx @@ -23,4 +26,4 @@ return { "message": "短信码已生成", "key": id } -} +} \ No newline at end of file