shoplazza-cli 1.0.4 → 1.0.5

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/bin/shoplazza CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ process.noDeprecation = true; // 全局禁用废弃警告
3
4
  const { program } = require('commander');
4
5
  const updateNotifier = require('update-notifier');
5
6
  const Sentry = require('@sentry/node');
@@ -40,11 +40,15 @@ request.interceptors.request.use((config) => {
40
40
  return config;
41
41
  });
42
42
 
43
+ const errorMapping = {
44
+ INVALID_ARGUMENT: 'Invalid argument',
45
+ PERMISSION_DENIED: 'Permission denied',
46
+ INTERNAL_ERROR: 'Internal error'
47
+ };
43
48
  const handleResponseError = (response) => {
44
- if (response.data?.status === 3 && response.data?.message === 'INVALID_ARGUMENT') {
45
- throw `Invalid argument at ${response.config.url}`;
46
- } else if (response.data?.status === 13 && response.data?.message === 'INTERNAL_ERROR') {
47
- throw `Internal error at ${response.config.url}`;
49
+ const errorMsg = errorMapping[response.data?.message];
50
+ if (errorMsg) {
51
+ throw `${errorMsg} at ${response.config.url}`;
48
52
  }
49
53
  };
50
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoplazza-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "bin/shoplazza",
6
6
  "engines": {