@iflyrpa/actions 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -12874,7 +12874,7 @@ var __webpack_exports__ = {};
12874
12874
  const lib_axios = axios;
12875
12875
  class Http {
12876
12876
  static handleApiError(error) {
12877
- if (error && 'object' == typeof error && 'code' in error && 'message' in error) return error;
12877
+ if (error && "object" == typeof error && "code" in error && "message" in error) return error;
12878
12878
  return {
12879
12879
  code: 500,
12880
12880
  message: "",
@@ -12887,15 +12887,25 @@ var __webpack_exports__ = {};
12887
12887
  addResponseInterceptor(findError) {
12888
12888
  this.apiClient.interceptors.response.use((response)=>{
12889
12889
  const error = findError(response);
12890
- return error ? Promise.reject(error) : response;
12890
+ if (error) return Promise.reject(Object.assign(error, {
12891
+ extra: {
12892
+ method: response.config.method,
12893
+ url: response.config.url
12894
+ }
12895
+ }));
12896
+ return response;
12891
12897
  }, (error)=>{
12892
12898
  const errorResponse = {
12893
12899
  code: error.response?.status || 500,
12894
12900
  message: error.message || "",
12895
- data: error.response?.data
12901
+ data: error.response?.data,
12902
+ extra: {
12903
+ method: error.config?.method,
12904
+ url: error.config?.url
12905
+ }
12896
12906
  };
12897
12907
  if (error.response?.data) {
12898
- if ('object' == typeof error.response.data) {
12908
+ if ("object" == typeof error.response.data) {
12899
12909
  const serverError = error.response.data;
12900
12910
  if (serverError.message) errorResponse.message = serverError.message;
12901
12911
  errorResponse.data = serverError;
@@ -13004,7 +13014,7 @@ var __webpack_exports__ = {};
13004
13014
  result = Http.handleApiError(error);
13005
13015
  }
13006
13016
  if (0 === result.code || 200 === result.code) break;
13007
- if (index !== actions.length - 1) task.logger.error(result.message, stringifyError(result.data));
13017
+ if (index !== actions.length - 1) task.logger.error(result.message, stringifyError(result.data), result.extra);
13008
13018
  }
13009
13019
  return result;
13010
13020
  };
@@ -13527,7 +13537,7 @@ var __webpack_exports__ = {};
13527
13537
  return success([]);
13528
13538
  }
13529
13539
  };
13530
- const searchXiaohongshuLocation = async (task, params)=>{
13540
+ const searchXiaohongshuLocation = async (_task, params)=>{
13531
13541
  const http = new Http({
13532
13542
  headers: {
13533
13543
  cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
@@ -13551,7 +13561,6 @@ var __webpack_exports__ = {};
13551
13561
  });
13552
13562
  return success(0 === result.code ? result.data.poi_list : []);
13553
13563
  } catch (error) {
13554
- task.logger.error("获取小红书地址失败");
13555
13564
  return success([]);
13556
13565
  }
13557
13566
  };
@@ -15271,7 +15280,7 @@ var __webpack_exports__ = {};
15271
15280
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
15272
15281
  };
15273
15282
  var package_namespaceObject = {
15274
- i8: "1.1.36"
15283
+ i8: "1.2.0"
15275
15284
  };
15276
15285
  class Action {
15277
15286
  constructor(task){
@@ -15287,7 +15296,7 @@ var __webpack_exports__ = {};
15287
15296
  }
15288
15297
  if (200 === responseData.code) this.task.logger.info(`${func.name} action params error`, responseData);
15289
15298
  else if (0 !== responseData.code) {
15290
- this.task.logger.error(responseData.message || `${func.name} 执行失败`, stringifyError(responseData.data));
15299
+ this.task.logger.error(responseData.message || `${func.name} 执行失败`, stringifyError(responseData.data), responseData.extra);
15291
15300
  this.task.logger.info(`${func.name} action failed`);
15292
15301
  } else this.task.logger.info(`${func.name} action success`);
15293
15302
  return responseData;