| 105 | } |
| 106 | |
| 107 | private parseError(code: number): Result[] { |
| 108 | const messages = { |
| 109 | 101: "缺少必填的参数", |
| 110 | 102: "不支持的语言类型", |
| 111 | 103: "翻译文本过长", |
| 112 | 108: "应用ID无效", |
| 113 | 110: "无相关服务的有效实例", |
| 114 | 111: "开发者账号无效", |
| 115 | 112: "请求服务无效", |
| 116 | 113: "查询为空", |
| 117 | 202: "签名检验失败,检查 KEY 和 SECRET", |
| 118 | 401: "账户已经欠费", |
| 119 | 411: "访问频率受限", |
| 120 | }; |
| 121 | |
| 122 | const message = messages[code] || "请参考错误码:" + code; |
| 123 | |
| 124 | return this.addResult("👻 翻译出错啦", message, "Ooops..."); |
| 125 | } |
| 126 | |
| 127 | private addResult( title: string, subtitle: string, arg: string = "", pronounce: string = ""): Result[] { |
| 128 | const quicklookurl = "https://www.youdao.com/w/" + this.word; |