@mcma/core 0.13.29 → 0.14.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.
@@ -14,13 +14,22 @@ class LogEvent {
14
14
  }
15
15
  flatten() {
16
16
  var _a, _b, _c, _d, _e;
17
+ let message = this.message;
18
+ if (message instanceof Error) {
19
+ if (this.message.stack) {
20
+ message = this.message.stack;
21
+ }
22
+ else {
23
+ message = this.message.toString();
24
+ }
25
+ }
17
26
  const logEventEntry = {
18
27
  type: this.type,
19
28
  level: this.level,
20
29
  source: this.source,
21
30
  requestId: this.requestId,
22
31
  timestamp: this.timestamp,
23
- message: this.message,
32
+ message,
24
33
  trackerId: (_a = this.tracker) === null || _a === void 0 ? void 0 : _a.id,
25
34
  trackerLabel: (_b = this.tracker) === null || _b === void 0 ? void 0 : _b.label,
26
35
  };
@@ -3,5 +3,5 @@ export declare class McmaException extends Error {
3
3
  cause?: McmaException;
4
4
  context?: any;
5
5
  constructor(message: string, cause?: McmaException, context?: any);
6
- toString(): string;
6
+ toString(includeDetails?: boolean): string;
7
7
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.McmaException = void 0;
4
+ const os_1 = require("os");
4
5
  class McmaException extends Error {
5
6
  constructor(message, cause, context) {
6
7
  super(message);
@@ -9,24 +10,25 @@ class McmaException extends Error {
9
10
  this.context = context;
10
11
  this.cause = cause;
11
12
  this.context = context;
13
+ this.stack = this.toString(true);
12
14
  }
13
- toString() {
15
+ toString(includeDetails = false) {
14
16
  var _a;
15
17
  let ret = "";
16
18
  let c = this;
17
19
  while (c) {
18
- if (c.stack) {
20
+ if (includeDetails && c.stack) {
19
21
  ret += c.stack;
20
22
  }
21
23
  else {
22
24
  ret += "Error: " + ((_a = c.message) !== null && _a !== void 0 ? _a : c);
23
25
  }
24
- if (c.context) {
25
- ret += "\nContext:\n" + JSON.stringify(c.context, null, 2);
26
+ if (includeDetails && c.context) {
27
+ ret += os_1.EOL + "Context:" + os_1.EOL + JSON.stringify(c.context, null, 2);
26
28
  }
27
29
  c = c.cause;
28
30
  if (c) {
29
- ret += "\nCaused by:\n";
31
+ ret += os_1.EOL + "Caused by: " + os_1.EOL;
30
32
  }
31
33
  }
32
34
  return ret;
@@ -1,6 +1,8 @@
1
1
  import { McmaObject, McmaObjectProperties } from "./mcma-object";
2
2
  export interface LocatorProperties extends McmaObjectProperties {
3
+ url: string;
3
4
  }
4
5
  export declare abstract class Locator extends McmaObject implements LocatorProperties {
6
+ url: string;
5
7
  protected constructor(type: string, properties?: LocatorProperties);
6
8
  }
@@ -5,6 +5,7 @@ const mcma_object_1 = require("./mcma-object");
5
5
  class Locator extends mcma_object_1.McmaObject {
6
6
  constructor(type, properties) {
7
7
  super(type, properties);
8
+ this.checkProperty("url", "string", true);
8
9
  }
9
10
  }
10
11
  exports.Locator = Locator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcma/core",
3
- "version": "0.13.29",
3
+ "version": "0.14.0",
4
4
  "description": "Node module with type definitions and helper utils for the EBU MCMA framework",
5
5
  "engines": {
6
6
  "node": "^14.17.0"