@fluid-experimental/property-common 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229
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/.eslintrc.js +9 -11
- package/.mocharc.json +6 -6
- package/README.md +1 -0
- package/api-extractor.json +2 -2
- package/dist/chronometer.d.ts.map +1 -1
- package/dist/chronometer.js.map +1 -1
- package/dist/consoleUtils.d.ts.map +1 -1
- package/dist/consoleUtils.js +4 -1
- package/dist/consoleUtils.js.map +1 -1
- package/dist/constants.d.ts +6 -6
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +16 -26
- package/dist/constants.js.map +1 -1
- package/dist/datastructures/collection.d.ts.map +1 -1
- package/dist/datastructures/collection.js +5 -4
- package/dist/datastructures/collection.js.map +1 -1
- package/dist/datastructures/dataArray.d.ts.map +1 -1
- package/dist/datastructures/dataArray.js +18 -9
- package/dist/datastructures/dataArray.js.map +1 -1
- package/dist/datastructures/integer64.d.ts.map +1 -1
- package/dist/datastructures/integer64.js +1 -1
- package/dist/datastructures/integer64.js.map +1 -1
- package/dist/datastructures/sortedCollection.d.ts.map +1 -1
- package/dist/datastructures/sortedCollection.js +3 -1
- package/dist/datastructures/sortedCollection.js.map +1 -1
- package/dist/deferredPromise.d.ts +1 -1
- package/dist/deferredPromise.d.ts.map +1 -1
- package/dist/deferredPromise.js +9 -3
- package/dist/deferredPromise.js.map +1 -1
- package/dist/deterministicRandomGenerator.d.ts.map +1 -1
- package/dist/deterministicRandomGenerator.js +6 -6
- package/dist/deterministicRandomGenerator.js.map +1 -1
- package/dist/error_objects/flaggedError.d.ts.map +1 -1
- package/dist/error_objects/flaggedError.js.map +1 -1
- package/dist/error_objects/httpError.d.ts.map +1 -1
- package/dist/error_objects/httpError.js +9 -9
- package/dist/error_objects/httpError.js.map +1 -1
- package/dist/error_objects/httpErrorNoStack.d.ts.map +1 -1
- package/dist/error_objects/httpErrorNoStack.js.map +1 -1
- package/dist/error_objects/operationError.d.ts +7 -7
- package/dist/error_objects/operationError.d.ts.map +1 -1
- package/dist/error_objects/operationError.js +7 -7
- package/dist/error_objects/operationError.js.map +1 -1
- package/dist/guidUtils.d.ts.map +1 -1
- package/dist/guidUtils.js +10 -9
- package/dist/guidUtils.js.map +1 -1
- package/dist/hashCalculator.d.ts.map +1 -1
- package/dist/hashCalculator.js.map +1 -1
- package/dist/joinPaths.d.ts.map +1 -1
- package/dist/joinPaths.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/chronometer.d.ts.map +1 -1
- package/lib/chronometer.js.map +1 -1
- package/lib/consoleUtils.d.ts.map +1 -1
- package/lib/consoleUtils.js +4 -1
- package/lib/consoleUtils.js.map +1 -1
- package/lib/constants.d.ts +6 -6
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +16 -26
- package/lib/constants.js.map +1 -1
- package/lib/datastructures/collection.d.ts.map +1 -1
- package/lib/datastructures/collection.js +5 -4
- package/lib/datastructures/collection.js.map +1 -1
- package/lib/datastructures/dataArray.d.ts.map +1 -1
- package/lib/datastructures/dataArray.js +18 -9
- package/lib/datastructures/dataArray.js.map +1 -1
- package/lib/datastructures/integer64.d.ts.map +1 -1
- package/lib/datastructures/integer64.js +1 -1
- package/lib/datastructures/integer64.js.map +1 -1
- package/lib/datastructures/sortedCollection.d.ts.map +1 -1
- package/lib/datastructures/sortedCollection.js +3 -1
- package/lib/datastructures/sortedCollection.js.map +1 -1
- package/lib/deferredPromise.d.ts +1 -1
- package/lib/deferredPromise.d.ts.map +1 -1
- package/lib/deferredPromise.js +9 -3
- package/lib/deferredPromise.js.map +1 -1
- package/lib/deterministicRandomGenerator.d.ts.map +1 -1
- package/lib/deterministicRandomGenerator.js +6 -6
- package/lib/deterministicRandomGenerator.js.map +1 -1
- package/lib/error_objects/flaggedError.d.ts.map +1 -1
- package/lib/error_objects/flaggedError.js.map +1 -1
- package/lib/error_objects/httpError.d.ts.map +1 -1
- package/lib/error_objects/httpError.js +9 -9
- package/lib/error_objects/httpError.js.map +1 -1
- package/lib/error_objects/httpErrorNoStack.d.ts.map +1 -1
- package/lib/error_objects/httpErrorNoStack.js.map +1 -1
- package/lib/error_objects/operationError.d.ts +7 -7
- package/lib/error_objects/operationError.d.ts.map +1 -1
- package/lib/error_objects/operationError.js +7 -7
- package/lib/error_objects/operationError.js.map +1 -1
- package/lib/guidUtils.d.ts.map +1 -1
- package/lib/guidUtils.js +10 -9
- package/lib/guidUtils.js.map +1 -1
- package/lib/hashCalculator.d.ts.map +1 -1
- package/lib/hashCalculator.js.map +1 -1
- package/lib/joinPaths.d.ts.map +1 -1
- package/lib/joinPaths.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +42 -40
- package/platform-dependent/README.md +1 -0
- package/platform-dependent/browser.js +5 -5
- package/platform-dependent/package.json +14 -14
- package/platform-dependent/server.js +5 -5
- package/prettier.config.cjs +1 -1
- package/src/chronometer.ts +174 -169
- package/src/consoleUtils.ts +16 -11
- package/src/constants.ts +1683 -1640
- package/src/datastructures/collection.ts +417 -416
- package/src/datastructures/dataArray.ts +516 -492
- package/src/datastructures/integer64.ts +102 -99
- package/src/datastructures/sortedCollection.ts +155 -145
- package/src/deferredPromise.ts +43 -42
- package/src/deterministicRandomGenerator.ts +59 -59
- package/src/error_objects/flaggedError.ts +29 -29
- package/src/error_objects/httpError.ts +45 -42
- package/src/error_objects/httpErrorNoStack.ts +17 -17
- package/src/error_objects/operationError.ts +62 -62
- package/src/guidUtils.ts +182 -171
- package/src/hashCalculator.ts +5 -2
- package/src/joinPaths.ts +15 -9
- package/src/packageVersion.ts +1 -1
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +9 -13
|
@@ -21,69 +21,69 @@ import { calculateHash } from "./hashCalculator";
|
|
|
21
21
|
* efficient.
|
|
22
22
|
*/
|
|
23
23
|
export class DeterministicRandomGenerator {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
_guid1: Uint32Array;
|
|
25
|
+
_guid2: Uint32Array;
|
|
26
|
+
_result: Uint32Array;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @param in_seed - The initial seed (it can be either a GUID or a number)
|
|
30
|
+
* which is used to initialize the random number generator.
|
|
31
|
+
*/
|
|
32
|
+
constructor(in_seed: string | number) {
|
|
33
|
+
// Initialize the internal state from the given initial guid
|
|
34
|
+
this._guid1 = _.isString(in_seed)
|
|
35
|
+
? GuidUtils.guidToUint32x4(in_seed)
|
|
36
|
+
: GuidUtils.guidToUint32x4(calculateHash(String(in_seed)));
|
|
37
|
+
this._guid2 = new Uint32Array(4);
|
|
38
|
+
this._guid2[0] = (this._guid1[0] + 1) >>> 0;
|
|
39
|
+
this._guid2[1] = (this._guid1[1] + 1) >>> 0;
|
|
40
|
+
this._guid2[2] = (this._guid1[2] + 1) >>> 0;
|
|
41
|
+
this._guid2[3] = (this._guid1[3] + 1) >>> 0;
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
this._result = new Uint32Array(4);
|
|
44
|
+
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Creates a floating point random number.
|
|
48
|
+
*
|
|
49
|
+
* @param in_max - If supplied the returned number will be 0 \<= number \< `in_max`.
|
|
50
|
+
* If none is given, `in_max` = 1 is assumed.
|
|
51
|
+
*
|
|
52
|
+
* @returns The random number.
|
|
53
|
+
*/
|
|
54
|
+
random(in_max = 1.0) {
|
|
55
|
+
const randomInteger = this.irandom();
|
|
56
|
+
return (randomInteger / 4294967296) * in_max;
|
|
57
|
+
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Creates an integer point random number.
|
|
61
|
+
*
|
|
62
|
+
* @param in_max - If supplied the returned number will be 0 \<= number \< `in_max`.
|
|
63
|
+
* If none is given, `in_max` = 14294967296 (2^32) is assumed.
|
|
64
|
+
*
|
|
65
|
+
* @returns The random number.
|
|
66
|
+
*/
|
|
67
|
+
irandom(in_max?: number): number {
|
|
68
|
+
// Create a new hash
|
|
69
|
+
GuidUtils.hashCombine4xUint32(this._guid1, this._guid2, this._result);
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
// Permute the hashes
|
|
72
|
+
for (let i = 0; i < 4; i++) {
|
|
73
|
+
this._guid1[i] = this._guid2[i];
|
|
74
|
+
this._guid2[i] = this._result[i];
|
|
75
|
+
}
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
if (in_max === undefined) {
|
|
78
|
+
return this._guid1[0];
|
|
79
|
+
} else {
|
|
80
|
+
return in_max < 16777619
|
|
81
|
+
? // The random generator doesn't seem to be very good.
|
|
82
|
+
// It is quite biased (e.g. it generates too many even numbers)
|
|
83
|
+
// this is a hack to solve at least this problem, but we probably should
|
|
84
|
+
// instead use a different approach altogether
|
|
85
|
+
(this._guid1[0] % 16777619) % in_max
|
|
86
|
+
: this._guid1[0] % in_max;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
89
|
}
|
|
@@ -9,39 +9,39 @@
|
|
|
9
9
|
* @param flag - A flag to be checked
|
|
10
10
|
* @returns True if the flag is set in passed flags, false otherwise.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const _isFlagSet = (flags: number, flag: number) => {
|
|
13
|
+
// eslint-disable-next-line no-bitwise
|
|
14
|
+
return (flags & flag) === flag;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export class FlaggedError {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Flags that may be set on an error instance.
|
|
20
|
+
*/
|
|
21
|
+
static FLAGS = {
|
|
22
|
+
/**
|
|
23
|
+
* A transient error results from an operation that could succeed if retried.
|
|
24
|
+
*/
|
|
25
|
+
TRANSIENT: 1,
|
|
26
|
+
/**
|
|
27
|
+
* A quiet error should not trigger an error log.
|
|
28
|
+
*/
|
|
29
|
+
QUIET: 2,
|
|
30
|
+
};
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
protected flags: number = 0;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @returns True if the quiet flag is set.
|
|
36
|
+
*/
|
|
37
|
+
isQuiet(): boolean {
|
|
38
|
+
return _isFlagSet(this.flags, FlaggedError.FLAGS.QUIET);
|
|
39
|
+
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
/**
|
|
42
|
+
* @returns True if the transient flag is set.
|
|
43
|
+
*/
|
|
44
|
+
isTransient(): boolean {
|
|
45
|
+
return _isFlagSet(this.flags, FlaggedError.FLAGS.TRANSIENT);
|
|
46
|
+
}
|
|
47
47
|
}
|
|
@@ -14,54 +14,57 @@ import { FlaggedError } from "./flaggedError";
|
|
|
14
14
|
* @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.
|
|
15
15
|
*/
|
|
16
16
|
export class HTTPError extends Error {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
constructor(
|
|
18
|
+
public title?: string,
|
|
19
|
+
public statusCode?: number,
|
|
20
|
+
public statusMessage?: string,
|
|
21
|
+
public method?: string,
|
|
22
|
+
public url?: string,
|
|
23
|
+
public flags = 0,
|
|
24
|
+
) {
|
|
25
|
+
super();
|
|
26
|
+
Object.setPrototypeOf(this, HTTPError.prototype);
|
|
27
|
+
this.name = "HTTPError";
|
|
28
|
+
this.message = this._generateMessage(title, statusCode, statusMessage, method, url);
|
|
29
|
+
this.stack = new Error(this.message).stack;
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
static FLAGS = FlaggedError.FLAGS;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
isQuiet(): boolean {
|
|
35
|
+
return FlaggedError.prototype.isQuiet.call(this);
|
|
36
|
+
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
isTransient(): boolean {
|
|
39
|
+
return FlaggedError.prototype.isTransient.call(this);
|
|
40
|
+
}
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
private _generateMessage(title, statusCode, statusMessage, method, url) {
|
|
43
|
+
const titleStr = title === undefined ? "" : String(title);
|
|
44
|
+
const statusCodeStr = statusCode === undefined ? "" : String(statusCode);
|
|
45
|
+
const statusMessageStr = statusMessage === undefined ? "" : String(statusMessage);
|
|
46
|
+
const methodStr = method === undefined ? "" : String(method);
|
|
47
|
+
const urlStr = url === undefined ? "" : String(url);
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
return (
|
|
50
|
+
`HTTPError: ${titleStr}, statusCode:${statusCodeStr}, ` +
|
|
51
|
+
`statusMessage:${statusMessageStr}, method:${methodStr}, url:${urlStr}`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Returns a string representing the HTTPError object
|
|
57
|
+
* @returns a string representing the HTTPError object
|
|
58
|
+
*/
|
|
59
|
+
toString(): string {
|
|
60
|
+
const stack = this.stack === undefined ? "" : String(this.stack);
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const isFirefox =
|
|
63
|
+
typeof window !== "undefined" &&
|
|
64
|
+
typeof window.navigator !== "undefined" &&
|
|
65
|
+
typeof window.navigator.userAgent !== "undefined" &&
|
|
66
|
+
window.navigator.userAgent.toLowerCase().includes("firefox");
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
return isFirefox ? `${this.message}, stack:${stack}` : `stack:${stack}`;
|
|
69
|
+
}
|
|
67
70
|
}
|
|
@@ -9,23 +9,23 @@ import { FlaggedError } from "./flaggedError";
|
|
|
9
9
|
* Class extending HTTPError without storing the stack
|
|
10
10
|
*/
|
|
11
11
|
export class HTTPErrorNoStack extends HTTPError {
|
|
12
|
-
|
|
12
|
+
static FLAGS = FlaggedError.FLAGS;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @param message - The error message
|
|
16
|
+
* @param statusCode - A numeric HTTP status code
|
|
17
|
+
* @param statusMessage - A string message representing the response status message
|
|
18
|
+
* @param method - The HTTP method used in the request
|
|
19
|
+
* @param url - The URL that the request was sent to
|
|
20
|
+
* @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.
|
|
21
|
+
*/
|
|
22
|
+
constructor(message?, statusCode?, statusMessage?, method?, url?, flags?) {
|
|
23
|
+
super(message, statusCode, statusMessage, method, url, flags);
|
|
24
|
+
Object.setPrototypeOf(this, HTTPErrorNoStack.prototype);
|
|
25
|
+
delete this.stack;
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
toString(): string {
|
|
29
|
+
return this.message;
|
|
30
|
+
}
|
|
31
31
|
}
|
|
@@ -13,78 +13,78 @@ import _ from "lodash";
|
|
|
13
13
|
import { FlaggedError } from "./flaggedError";
|
|
14
14
|
|
|
15
15
|
export class OperationError extends Error {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
static FLAGS = FlaggedError.FLAGS;
|
|
17
|
+
public stack: string | undefined;
|
|
18
|
+
public readonly name: string;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Instantiates an OperationError, which mimics the Error class with added properties
|
|
22
|
+
* meant for reporting the result of operations.
|
|
23
|
+
* @param message - The error message.
|
|
24
|
+
* @param operation - The operation name.
|
|
25
|
+
* @param statusCode - The operation result as a numerical status code.
|
|
26
|
+
* @param flags - Flags that characterize the error. See {@link FlaggedError.FLAGS}.
|
|
27
|
+
*/
|
|
28
|
+
constructor(
|
|
29
|
+
message?: string,
|
|
30
|
+
public operation?: string,
|
|
31
|
+
public statusCode?: number,
|
|
32
|
+
public flags: number = 0,
|
|
33
|
+
) {
|
|
34
|
+
super(message);
|
|
35
|
+
Object.setPrototypeOf(this, OperationError.prototype);
|
|
36
|
+
this.name = "OperationError";
|
|
37
|
+
this.stack = Error(message).stack;
|
|
38
|
+
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
isQuiet() {
|
|
41
|
+
return FlaggedError.prototype.isQuiet.call(this);
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
isTransient() {
|
|
45
|
+
return FlaggedError.prototype.isTransient.call(this);
|
|
46
|
+
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @returns A string representation of the error flags.
|
|
50
|
+
*/
|
|
51
|
+
private _flagsToString() {
|
|
52
|
+
const flagArray: string[] = [];
|
|
53
|
+
_.mapValues(FlaggedError.FLAGS, (flagValue, flagName) => {
|
|
54
|
+
// eslint-disable-next-line no-bitwise
|
|
55
|
+
if ((this.flags & flagValue) === flagValue) {
|
|
56
|
+
flagArray.push(flagName);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return `${this.flags} [${flagArray.join(",")}]`;
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
toString(): string {
|
|
63
|
+
const extendedFieldsArray: string[] = [];
|
|
64
|
+
if (this.operation !== undefined) {
|
|
65
|
+
extendedFieldsArray.push(this.operation);
|
|
66
|
+
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
if (this.statusCode !== undefined) {
|
|
69
|
+
extendedFieldsArray.push(this.statusCode.toString());
|
|
70
|
+
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
if (this.flags) {
|
|
73
|
+
extendedFieldsArray.push(this._flagsToString.call(this));
|
|
74
|
+
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
let msg = this.name;
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
if (extendedFieldsArray.length > 0) {
|
|
79
|
+
msg += `[${extendedFieldsArray.join(", ")}]`;
|
|
80
|
+
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
msg += `: ${this.message}`;
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
if (this.stack !== undefined) {
|
|
85
|
+
msg += `, stack: ${this.stack}`;
|
|
86
|
+
}
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
return msg;
|
|
89
|
+
}
|
|
90
90
|
}
|