Skip to content

[BUG][Major] http code 不为 200 但 api 接口有返回信息时,没有显示完整的错误信息 #2

@PIGfaces

Description

@PIGfaces

问题描述
调用 closeSpeechApi 方法时,传入了空的 requestIdLists 返回的错误信息只有的错误信息,错误码为 103,错误信息为:unknow message

{code=103, message=unknown error, originalMessage=Server returned HTTP response code: 400 for URL: http://api.open.tuputech.com/v3/recognition/speech/stream/close/*****************}

但实际上 api 是有返回具体的错误码和错误信息的: {"json":"{\"code\":15,\"message\":\"ValidationError: \\\"requestId\\\" is required\"},需要在向 api 发送请求前校验传入参数是否合法,避免传入空请求

问题复现步骤:

  1. 调用 closeSpeechApi 方法,传入空的 requestIdLists 或者 空的字符串

期望的表现:

  1. requestIdLists 为空时需要提前报错(在请求API接口之前)
  2. api 接口返回了非 200 的 http code 也需要输出 api 返回的信息

观察到的表现:

  1. originalMessage 显示的错误信息只有 http 的 error messaga 没有 api 返回的(如问题描述中所述)
  2. code 为 103 而不是 15

屏幕截图
wecom-temp-e0ef028aab56c9e47595d83f486e63ad

sdk 版本

  • 1.2.9

需求或者建议

  1. 出错时能显示 http 的 message 以及 api 响应的真实 code 和 message
  2. 语音 SDK 的请求域名修改:api.open.tuputech.com => api.speech.tuputech.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions