@ossy/deployment-tools 0.0.27 → 0.0.28

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/index.js CHANGED
@@ -58353,9 +58353,10 @@ var __webpack_exports__ = {};
58353
58353
  (() => {
58354
58354
 
58355
58355
  ;// CONCATENATED MODULE: ./src/log/index.ts
58356
- const log = ({ type, message } = { type: 'info', message: '' }) => {
58356
+ const log = ({ type, message, error } = { type: 'info', message: '' }) => {
58357
58357
  const messagePrefix = `[${type.toUpperCase()}]${message.startsWith('[') ? '' : ': '}`;
58358
58358
  console.log(`${messagePrefix}${message}`);
58359
+ error && console.log('\t[Reason]:', error);
58359
58360
  };
58360
58361
 
58361
58362
  // EXTERNAL MODULE: ./node_modules/arg/index.js
@@ -60773,7 +60774,11 @@ class DeploymentQueueClient {
60773
60774
  });
60774
60775
  return sqsClient.send(command)
60775
60776
  .then(() => log({ type: 'info', message: '[DeploymentQueueClient] Deployment request sent' }))
60776
- .catch(() => log({ type: 'error', message: '[DeploymentQueueClient] Could not send deployment request' }));
60777
+ .catch(error => log({
60778
+ type: 'error',
60779
+ message: '[DeploymentQueueClient] Could not send deployment request',
60780
+ error
60781
+ }));
60777
60782
  });
60778
60783
  }
60779
60784
  static pollForDeploymentRequests(deploymentPlatform, handleDeploymentRequest) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/deployment-tools",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "description": "Collection of scripts and tools to aid deployment of containers and static files",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -39,7 +39,7 @@ export class CaddyClient {
39
39
  }
40
40
  ]))
41
41
  })
42
- .catch(() => log({ type: 'error', message: `[CaddyClient] Could not update caddy config to include ${url}` }))
42
+ .catch(error => log({ type: 'error', message: `[CaddyClient] Could not update caddy config to include ${url}`, error }))
43
43
  }
44
44
 
45
45
  static applyDefaultServerConfig(deploymentPlatform: DeploymentPlatform) {
@@ -105,7 +105,7 @@ export class CaddyClient {
105
105
  }
106
106
  })
107
107
  })
108
- .catch(() => log({ type: 'error', message: '[CaddyClient] Could not apply default caddy config' }))
108
+ .catch(error => log({ type: 'error', message: '[CaddyClient] Could not apply default caddy config', error }))
109
109
  }
110
110
 
111
111
  }
@@ -37,7 +37,7 @@ export class DeploymentPlatformClient {
37
37
  )
38
38
 
39
39
  })
40
- .catch(() => log({ type: 'error', message: '[DeploymentPlatformClient] Could not start the deployment platform' }))
40
+ .catch(error => log({ type: 'error', message: '[DeploymentPlatformClient] Could not start the deployment platform', error }))
41
41
  }
42
42
 
43
43
  //eslint-disable-next-line max-params
@@ -85,7 +85,7 @@ export class DeploymentPlatformClient {
85
85
 
86
86
  })
87
87
  })
88
- .catch(error => console.log(error))
88
+ .catch(error => log({ type: 'error', message: '[DeploymentPlatformClient] Could not send deployment request', error }))
89
89
  }
90
90
 
91
91
  static getDeploymentTemplates(pathToOssyFile: string): Promise<DeploymentTemplate[]> {
@@ -22,7 +22,11 @@ export class DeploymentQueueClient {
22
22
 
23
23
  return sqsClient.send(command)
24
24
  .then(() => log({ type: 'info', message: '[DeploymentQueueClient] Deployment request sent' }))
25
- .catch(() => log({ type: 'error', message: '[DeploymentQueueClient] Could not send deployment request' }))
25
+ .catch(error => log({
26
+ type: 'error',
27
+ message: '[DeploymentQueueClient] Could not send deployment request',
28
+ error
29
+ }))
26
30
 
27
31
  })
28
32
 
@@ -52,11 +56,11 @@ export class DeploymentQueueClient {
52
56
 
53
57
  sqsClient.send(deleteMessageCommand)
54
58
  .then(() => log({ type: 'info', message: '[DeploymentQueueClient] Removing deployment request from queue' }))
55
- .catch(() => log({ type: 'error', message: '[DeploymentQueueClient] Removing deployment request from queue' }))
59
+ .catch(error => log({ type: 'error', message: '[DeploymentQueueClient] Could not delete message from queue', error }))
56
60
  })
57
61
 
58
62
  }))
59
- .catch(() => log({ type: 'error', message: '[ContainerManagerServer] Could not handle incoming deployment request' }))
63
+ .catch(error => log({ type: 'error', message: '[ContainerManagerServer] Could not handle incoming deployment request', error }))
60
64
  }, FIVE_MINUTES)
61
65
 
62
66
  })
package/src/log/index.ts CHANGED
@@ -1,4 +1,11 @@
1
- export const log = ({ type, message } = { type: 'info', message: '' }) => {
1
+ interface LogInput {
2
+ type: 'info' | 'error';
3
+ message: string;
4
+ error?: any;
5
+ }
6
+
7
+ export const log = ({ type, message, error }: LogInput = { type: 'info', message: '' }) => {
2
8
  const messagePrefix = `[${type.toUpperCase()}]${message.startsWith('[') ? '' : ': '}`
3
9
  console.log(`${messagePrefix}${message}`)
10
+ error && console.log('\t[Reason]:', error)
4
11
  }