@@ -1,2 +0,2 @@ | ||
| import { YqgStatus, YqgResponse, YqgStatusCodeMap } from './constant'; | ||
| import { YqgStatus, YqgResponse, YqgError, YqgStatusCodeMap } from './constant'; | ||
| interface ResponseProtocolOption { | ||
@@ -12,3 +12,3 @@ debug?: boolean; | ||
| success(body?: any): YqgResponse; | ||
| error(code: number | string | YqgStatus | Error, detail?: string): YqgResponse; | ||
| error(code: number | string | YqgStatus | YqgError | Error, detail?: string): YqgResponse; | ||
| throw(code: number | string | YqgStatus | Error, detail?: string): never; | ||
@@ -15,0 +15,0 @@ } |
@@ -48,3 +48,3 @@ "use strict"; | ||
| ResponseProtocol.prototype.error = function (code, detail) { | ||
| var status = this.status(code); | ||
| var status = (code instanceof constant_1.YqgError) ? code.yqgStatus : this.status(code); | ||
| if (detail) { | ||
@@ -51,0 +51,0 @@ status.detail = detail; |
+1
-1
| { | ||
| "name": "@yqg/http", | ||
| "version": "0.0.4", | ||
| "version": "0.0.5", | ||
| "author": "YQG <developer@yangqianguan.com>", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/yqg-fe/yqg-util/tree/master/packages/@yqg/http", |
7838
1.01%