@serverless-devs/s3 0.0.15-beta.8 → 0.1.0

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.
@@ -6,14 +6,37 @@ const { Report } = require('./lib');
6
6
 
7
7
  // Exit process when offline
8
8
  setTimeout(process.exit, 1000 * 30);
9
- const { type, template, uid, argv, component } = JSON.parse(process.argv[2]);
9
+ const { type, template, uid, argv, component, message, userAgent } = JSON.parse(process.argv[2]);
10
10
  console.log('type', type);
11
- console.log('template', template);
12
- console.log('uid', uid);
13
- console.log('argv', argv);
14
- console.log('component', component);
15
11
  const instance = new Report();
16
- type === 'init' ? await instance.reportInit({ template }) : await instance.reportCommand({ uid, argv, component });
12
+ const run = async () => {
13
+ if (type === 'init') {
14
+ console.log('template', template);
15
+ return await instance.reportInit({ template });
16
+ }
17
+ console.log('userAgent', userAgent)
18
+ if (type === 'command') {
19
+ console.log('uid', uid);
20
+ console.log('argv', argv);
21
+ console.log('component', component);
22
+ return await instance.reportCommand({ uid, argv, component, userAgent })
23
+ }
24
+ // 解析异常
25
+ if (type === 'parseException') {
26
+ console.log('argv', argv);
27
+ console.log('message', message);
28
+ return await instance.reportParseException({ argv, message, userAgent })
29
+ }
30
+ // 执行异常
31
+ if (type === 'runtimeException') {
32
+ console.log('uid', uid);
33
+ console.log('argv', argv);
34
+ console.log('component', component);
35
+ console.log('message', message);
36
+ return await instance.reportRuntimeException({ uid, argv, component, message, userAgent })
37
+ }
38
+ }
39
+ await run();
17
40
  console.log('********report successfully in daemon********');
18
41
  // Call process exit explicitly to terminate the child process,
19
42
  // otherwise the child process will run forever, according to the Node.js docs