|
@@ -110,7 +110,10 @@ export class HttpHelper {
|
|
|
if (data.responseCode === 200) {
|
|
|
resolve((typeof data.result === 'string' ? JSON.parse(data.result) : data.result) as T)
|
|
|
} else {
|
|
|
- reject('服务异常')
|
|
|
+ const err: Error = new Error()
|
|
|
+ err.name = data.responseCode.toString()
|
|
|
+ err.message = '服务异常'
|
|
|
+ reject(err)
|
|
|
}
|
|
|
}).catch((err: Error) => {
|
|
|
if (this.httpHandlerList.hasKey(apiNo ?? params.url)) {
|
|
@@ -179,7 +182,10 @@ export class HttpHelper {
|
|
|
if (data.responseCode === 200) {
|
|
|
resolve((typeof data.result === 'string' ? JSON.parse(data.result) : data.result) as T)
|
|
|
} else {
|
|
|
- reject('服务异常')
|
|
|
+ const err: Error = new Error()
|
|
|
+ err.name = data.responseCode.toString()
|
|
|
+ err.message = '服务异常'
|
|
|
+ reject(err)
|
|
|
}
|
|
|
}).catch((err: Error) => {
|
|
|
if (this.httpHandlerList.hasKey(apiNo ?? params.url)) {
|
|
@@ -245,7 +251,10 @@ export class HttpHelper {
|
|
|
if (data.responseCode === 200) {
|
|
|
resolve((typeof data.result === 'string' ? JSON.parse(data.result) : data.result) as T)
|
|
|
} else {
|
|
|
- reject('服务异常')
|
|
|
+ const err: Error = new Error()
|
|
|
+ err.name = data.responseCode.toString()
|
|
|
+ err.message = '服务异常'
|
|
|
+ reject(err)
|
|
|
}
|
|
|
}).catch((err: Error) => {
|
|
|
if (this.httpHandlerList.hasKey(apiNo ?? params.url)) {
|