@fluidframework/telemetry-utils 2.71.0 → 2.72.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.
- package/CHANGELOG.md +4 -12
- package/dist/error.d.ts +3 -3
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +2 -4
- package/dist/error.js.map +1 -1
- package/dist/fluidErrorBase.d.ts.map +1 -1
- package/dist/fluidErrorBase.js +1 -3
- package/dist/fluidErrorBase.js.map +1 -1
- package/lib/error.d.ts +3 -3
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +3 -5
- package/lib/error.js.map +1 -1
- package/lib/fluidErrorBase.d.ts.map +1 -1
- package/lib/fluidErrorBase.js +2 -4
- package/lib/fluidErrorBase.js.map +1 -1
- package/package.json +10 -10
- package/src/error.ts +3 -3
- package/src/fluidErrorBase.ts +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# @fluidframework/telemetry-utils
|
|
2
2
|
|
|
3
|
+
## 2.72.0
|
|
4
|
+
|
|
5
|
+
Dependency updates only.
|
|
6
|
+
|
|
3
7
|
## 2.71.0
|
|
4
8
|
|
|
5
9
|
Dependency updates only.
|
|
@@ -181,7 +185,6 @@ Dependency updates only.
|
|
|
181
185
|
TypeScript types and implementation code.
|
|
182
186
|
|
|
183
187
|
This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
|
|
184
|
-
|
|
185
188
|
- `"moduleResolution": "Node16"` with `"module": "Node16"`
|
|
186
189
|
- `"moduleResolution": "Bundler"` with `"module": "ESNext"`
|
|
187
190
|
|
|
@@ -223,7 +226,6 @@ Dependency updates only.
|
|
|
223
226
|
- Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
224
227
|
|
|
225
228
|
The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
|
|
226
|
-
|
|
227
229
|
- @fluidframework/gitresources
|
|
228
230
|
- @fluidframework/server-kafka-orderer
|
|
229
231
|
- @fluidframework/server-lambdas
|
|
@@ -292,7 +294,6 @@ Dependency updates only.
|
|
|
292
294
|
- Dependencies on @fluidframework/protocol-definitions package updated to 3.0.0 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
293
295
|
|
|
294
296
|
This included the following changes from the protocol-definitions release:
|
|
295
|
-
|
|
296
297
|
- Updating signal interfaces for some planned improvements. The intention is split the interface between signals
|
|
297
298
|
submitted by clients to the server and the resulting signals sent from the server to clients.
|
|
298
299
|
- A new optional type member is available on the ISignalMessage interface and a new ISentSignalMessage interface has
|
|
@@ -303,7 +304,6 @@ Dependency updates only.
|
|
|
303
304
|
- Server upgrade: dependencies on Fluid server packages updated to 2.0.1 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
|
|
304
305
|
|
|
305
306
|
Dependencies on the following Fluid server package have been updated to version 2.0.1:
|
|
306
|
-
|
|
307
307
|
- @fluidframework/gitresources: 2.0.1
|
|
308
308
|
- @fluidframework/server-kafka-orderer: 2.0.1
|
|
309
309
|
- @fluidframework/server-lambdas: 2.0.1
|
|
@@ -334,7 +334,6 @@ Dependency updates only.
|
|
|
334
334
|
All members of the **@fluidframework/container-utils** package have been deprecated and the package is now removed.
|
|
335
335
|
|
|
336
336
|
Migration by API member:
|
|
337
|
-
|
|
338
337
|
- `ClientSessionExpiredError` (deprecated in `2.0.0-internal.6.2.0`): No replacement API offered.
|
|
339
338
|
- `DataCorruptionError` (deprecated in `2.0.0-internal.6.2.0`): Import from [@fluidframework/telemetry-utils](https://www.npmjs.com/package/@fluidframework/telemetry-utils) instead.
|
|
340
339
|
- `DataProcessingError` (deprecated in `2.0.0-internal.6.2.0`): Import from [@fluidframework/telemetry-utils](https://www.npmjs.com/package/@fluidframework/telemetry-utils) instead.
|
|
@@ -349,7 +348,6 @@ Dependency updates only.
|
|
|
349
348
|
### Minor Changes
|
|
350
349
|
|
|
351
350
|
- Upcoming: The type of the logger property/param in various APIs will be changing ([#17350](https://github.com/microsoft/FluidFramework/issues/17350)) [27284bcda3](https://github.com/microsoft/FluidFramework/commits/27284bcda3d63cc4306cf76806f8a075db0db60f)
|
|
352
|
-
|
|
353
351
|
- @fluidframework/runtime-definitions
|
|
354
352
|
- `IFluidDataStoreRuntime.logger` will be re-typed as `ITelemetryBaseLogger`
|
|
355
353
|
- @fluidframework/odsp-driver
|
|
@@ -365,7 +363,6 @@ Dependency updates only.
|
|
|
365
363
|
- Cleaning up duplicate or misnamed telemetry types ([#17149](https://github.com/microsoft/FluidFramework/issues/17149)) [f9236942fa](https://github.com/microsoft/FluidFramework/commits/f9236942faf03cde860bfcbc7c28f8fbd81d3868)
|
|
366
364
|
|
|
367
365
|
We have two sets of telemetry-related interfaces:
|
|
368
|
-
|
|
369
366
|
- The "Base" ones
|
|
370
367
|
- These have a very bare API surface
|
|
371
368
|
- They are used on public API surfaces to transmit logs across layers
|
|
@@ -375,14 +372,12 @@ Dependency updates only.
|
|
|
375
372
|
- They are used for instrumenting our code, and then normalize and pass off the logs via the Base interface
|
|
376
373
|
|
|
377
374
|
There are two problems with the given state of the world:
|
|
378
|
-
|
|
379
375
|
1. The "Base" ones were not named consistently, so the distinction was not as apparent as it could be
|
|
380
376
|
2. The internal ones were copied to `@fluidframework/telemetry-utils` and futher extended, but the original duplicates remain.
|
|
381
377
|
|
|
382
378
|
This change addresses these by adding "Base" to the name of each base type, and deprecating the old duplicate internal types.
|
|
383
379
|
|
|
384
380
|
Additionally, the following types were adjusted:
|
|
385
|
-
|
|
386
381
|
- `TelemetryEventCategory` is moving from `@fluidframework/core-interfaces` to `@fluidframework/telemetry-utils`
|
|
387
382
|
- Several types modeling "tagged" telemetry properties are deprecated in favor of a generic type `Tagged<V>`
|
|
388
383
|
|
|
@@ -394,7 +389,6 @@ Dependency updates only.
|
|
|
394
389
|
|
|
395
390
|
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now
|
|
396
391
|
imported from the **@fluidframework/core-interfaces** package:
|
|
397
|
-
|
|
398
392
|
- interface IDisposable
|
|
399
393
|
- interface IErrorEvent
|
|
400
394
|
- interface IErrorEvent
|
|
@@ -437,7 +431,6 @@ Dependency updates only.
|
|
|
437
431
|
- Remove Deprecated Loggers [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
|
|
438
432
|
|
|
439
433
|
This change removes the previously deprecated logger implementations. The following replacements are available:
|
|
440
|
-
|
|
441
434
|
- replace ChildLogger.create, new TelemetryNullLogger, and new BaseTelemetryNullLogger with createChildLogger
|
|
442
435
|
- replace new MultiSinkLogger with createMultiSinkLogger
|
|
443
436
|
- replace TelemetryUTLogger with MockLogger
|
|
@@ -460,7 +453,6 @@ Dependency updates only.
|
|
|
460
453
|
This change deprecates our internal TelemetryLogger implementations and unifies our exported and consumed surface area on our telemetry interfaces.
|
|
461
454
|
|
|
462
455
|
For the deprecated implementations the following replacement function should be used:
|
|
463
|
-
|
|
464
456
|
- replace ChildLogger.create, new TelemetryNullLogger, and new BaseTelemetryNullLogger with createChildLogger
|
|
465
457
|
- replace new MultiSinkLogger with createMultiSinkLogger
|
|
466
458
|
- replace TelemetryUTLogger with MockLogger
|
package/dist/error.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IErrorBase, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
6
|
-
import {
|
|
6
|
+
import { type IGenericError, type ILayerIncompatibilityError, type IUsageError } from "@fluidframework/core-interfaces/internal";
|
|
7
7
|
import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
8
8
|
import { LoggingError } from "./errorLogging.js";
|
|
9
9
|
import type { IFluidErrorBase } from "./fluidErrorBase.js";
|
|
@@ -102,8 +102,8 @@ export declare class DataProcessingError extends LoggingError implements IErrorB
|
|
|
102
102
|
*
|
|
103
103
|
* @internal
|
|
104
104
|
*/
|
|
105
|
-
export declare class LayerIncompatibilityError extends
|
|
106
|
-
|
|
105
|
+
export declare class LayerIncompatibilityError extends LoggingError implements ILayerIncompatibilityError {
|
|
106
|
+
readonly errorType: "layerIncompatibilityError";
|
|
107
107
|
readonly layer: string;
|
|
108
108
|
readonly layerVersion: string;
|
|
109
109
|
readonly incompatibleLayer: string;
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAGN,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,WAAW,EAChB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAE7F,OAAO,EACN,YAAY,EAKZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CACnC,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,wBAAwB,GAC9B,OAAO,CAAC,SAAS,CAInB;AA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,0BAA0B;IAErC,SAAgB,SAAS,8BAAkD;IAC3E,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,iBAAiB,EAAE,MAAM,CAAC;IAC1C,SAAgB,wBAAwB,EAAE,MAAM,CAAC;IACjD,SAAgB,iCAAiC,EAAE,MAAM,CAAC;IAC1D,SAAgB,wBAAwB,EAAE,MAAM,CAAC;IACjD,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAG/B,OAAO,EAAE,MAAM,EACf,oBAAoB,EAAE;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,wBAAwB,EAAE,MAAM,CAAC;QACjC,iCAAiC,EAAE,MAAM,CAAC;QAC1C,wBAAwB,EAAE,MAAM,CAAC;QACjC,OAAO,EAAE,MAAM,CAAC;KAChB,EACD,cAAc,CAAC,EAAE,wBAAwB;CAgB1C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,gBAC/B,QACZ,KACC,yBAAyB,EACvB,UAAU,GACV,gBAAgB,GAChB,sBAAsB,GACtB,yBAAyB,GACzB,uBAAuB,GACvB,WAAW,CACb,CACD,KACC;IACF,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,2BAA2B,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,8BAA8B,EAAE,MAAM,GAAG,SAAS,CAAC;IACnD,4BAA4B,EAAE,MAAM,GAAG,SAAS,CAAC;IACjD,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CAQpC,CAAC"}
|
package/dist/error.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
var _a;
|
|
7
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
7
|
exports.extractSafePropertiesFromMessage = exports.LayerIncompatibilityError = exports.DataProcessingError = exports.DataCorruptionError = exports.UsageError = exports.GenericError = exports.validatePrecondition = void 0;
|
|
9
8
|
const internal_1 = require("@fluidframework/core-interfaces/internal");
|
|
@@ -160,14 +159,14 @@ exports.DataProcessingError = DataProcessingError;
|
|
|
160
159
|
*
|
|
161
160
|
* @internal
|
|
162
161
|
*/
|
|
163
|
-
class LayerIncompatibilityError extends
|
|
162
|
+
class LayerIncompatibilityError extends errorLogging_js_1.LoggingError {
|
|
164
163
|
constructor(message, incompatibilityProps, telemetryProps) {
|
|
165
164
|
super(message, {
|
|
166
165
|
...incompatibilityProps,
|
|
167
166
|
...telemetryProps,
|
|
168
167
|
layerIncompatibilityError: true,
|
|
169
168
|
});
|
|
170
|
-
this
|
|
169
|
+
this.errorType = internal_1.FluidErrorTypesAlpha.layerIncompatibilityError;
|
|
171
170
|
this.layer = incompatibilityProps.layer;
|
|
172
171
|
this.layerVersion = incompatibilityProps.layerVersion;
|
|
173
172
|
this.incompatibleLayer = incompatibilityProps.incompatibleLayer;
|
|
@@ -179,7 +178,6 @@ class LayerIncompatibilityError extends UsageError {
|
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
exports.LayerIncompatibilityError = LayerIncompatibilityError;
|
|
182
|
-
_a = internal_1.layerIncompatibilityErrorSymbol;
|
|
183
181
|
/**
|
|
184
182
|
* Extracts specific properties from the provided message that we know are safe to log.
|
|
185
183
|
*
|
package/dist/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAGH,uEAMkD;AAGlD,uDAM2B;AAI3B;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CACnC,SAAkB,EAClB,OAAe,EACf,KAAgC;IAEhC,IAAI,CAAC,SAAS,EAAE,CAA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C7D,8BAA8B,EAAE,WAAW,CAAC,uBAAuB;IACnE,4BAA4B,EAAE,WAAW,CAAC,qBAAqB;IAC/D,gBAAgB,EAAE,WAAW,CAAC,SAAS;CACvC,CAAC,CAAC;AA1BU,QAAA,gCAAgC,oCA0B1C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IErrorBase, ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidErrorTypes,\n\tlayerIncompatibilityErrorSymbol,\n\ttype IGenericError,\n\ttype ILayerIncompatibilityError,\n\ttype IUsageError,\n} from \"@fluidframework/core-interfaces/internal\";\nimport type { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport {\n\tLoggingError,\n\tNORMALIZED_ERROR_TYPE,\n\tisExternalError,\n\tnormalizeError,\n\twrapError,\n} from \"./errorLogging.js\";\nimport type { IFluidErrorBase } from \"./fluidErrorBase.js\";\nimport type { ITelemetryPropertiesExt } from \"./telemetryTypes.js\";\n\n/**\n * Throws a UsageError with the given message if the condition is not met.\n * Use this API when `false` indicates a precondition is not met on a public API (for any FF layer).\n *\n * @param condition - The condition that should be true, if the condition is false a UsageError will be thrown.\n * @param message - The message to include in the error when the condition does not hold.\n * @param props - Telemetry props to include on the error when the condition does not hold.\n * @internal\n */\nexport function validatePrecondition(\n\tcondition: boolean,\n\tmessage: string,\n\tprops?: ITelemetryBaseProperties,\n): asserts condition {\n\tif (!condition) {\n\t\tthrow new UsageError(message, props);\n\t}\n}\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n *\n * @internal\n */\nexport class GenericError extends LoggingError implements IGenericError, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.genericError;\n\n\t/**\n\t * Create a new GenericError\n\t * @param message - Error message\n\t * @param error - inner error object\n\t * @param props - Telemetry props to include when the error is logged\n\t */\n\tpublic constructor(\n\t\tmessage: string,\n\t\t// TODO: Use `unknown` instead (API breaking change because error is not just an input parameter, but a public member of the class)\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\t\tpublic readonly error?: any,\n\t\tprops?: ITelemetryBaseProperties,\n\t) {\n\t\t// Don't try to log the inner error\n\t\tsuper(message, props, new Set([\"error\"]));\n\t}\n}\n\n/**\n * Error indicating an API is being used improperly resulting in an invalid operation.\n *\n * @internal\n */\nexport class UsageError extends LoggingError implements IUsageError, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.usageError;\n\n\tpublic constructor(message: string, props?: ITelemetryBaseProperties) {\n\t\tsuper(message, { ...props, usageError: true });\n\t}\n}\n\n/**\n * DataCorruptionError indicates that we encountered definitive evidence that the data at rest\n * backing this container is corrupted, and this container would never be expected to load properly again\n *\n * @internal\n */\nexport class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.dataCorruptionError;\n\tpublic readonly canRetry = false;\n\n\tpublic constructor(message: string, props: ITelemetryBaseProperties) {\n\t\tsuper(message, { ...props, dataProcessingError: 1 });\n\t}\n}\n\n/**\n * Indicates we hit a fatal error while processing incoming data from the Fluid Service.\n *\n * @remarks\n *\n * The error will often originate in the dataStore or DDS implementation that is responding to incoming changes.\n * This differs from {@link DataCorruptionError} in that this may be a transient error that will not repro in another\n * client or session.\n *\n * @internal\n */\nexport class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\t/**\n\t * {@inheritDoc IFluidErrorBase.errorType}\n\t */\n\tpublic readonly errorType = FluidErrorTypes.dataProcessingError;\n\n\tpublic readonly canRetry = false;\n\n\tprivate constructor(errorMessage: string, props?: ITelemetryBaseProperties) {\n\t\tsuper(errorMessage, props);\n\t}\n\n\t/**\n\t * Create a new `DataProcessingError` detected and raised within the Fluid Framework.\n\t */\n\tpublic static create(\n\t\terrorMessage: string,\n\t\tdataProcessingCodepath: string,\n\t\tsequencedMessage?: ISequencedDocumentMessage,\n\t\tprops: ITelemetryPropertiesExt = {},\n\t\tstackTraceLimit?: number,\n\t): IFluidErrorBase {\n\t\tconst ErrorConfig = Error as unknown as { stackTraceLimit: number };\n\t\tconst originalStackTraceLimit = ErrorConfig.stackTraceLimit;\n\t\ttry {\n\t\t\tif (stackTraceLimit !== undefined) {\n\t\t\t\tErrorConfig.stackTraceLimit = stackTraceLimit;\n\t\t\t}\n\n\t\t\tconst dataProcessingError = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terrorMessage,\n\t\t\t\tdataProcessingCodepath,\n\t\t\t\tsequencedMessage,\n\t\t\t);\n\t\t\tdataProcessingError.addTelemetryProperties(props);\n\n\t\t\treturn dataProcessingError;\n\t\t} finally {\n\t\t\t// Reset the stack trace limit to the original value\n\t\t\tif (stackTraceLimit !== undefined) {\n\t\t\t\tErrorConfig.stackTraceLimit = originalStackTraceLimit;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Wrap the given error in a `DataProcessingError`, unless the error is already of a known type\n\t * with the exception of a normalized {@link LoggingError}, which will still be wrapped.\n\t *\n\t * In either case, the error will have some relevant properties added for telemetry.\n\t *\n\t * @remarks\n\t *\n\t * We wrap conditionally since known error types represent well-understood failure modes, and ideally\n\t * one day we will move away from throwing these errors but rather we'll return them.\n\t * But an unrecognized error needs to be classified as `DataProcessingError`.\n\t *\n\t * @param originalError - The error to be converted.\n\t * @param dataProcessingCodepath - Which code-path failed while processing data.\n\t * @param messageLike - Message to include info about via telemetry props.\n\t *\n\t * @returns Either a new `DataProcessingError`, or (if wrapping is deemed unnecessary) the given error.\n\t */\n\tpublic static wrapIfUnrecognized(\n\t\toriginalError: unknown,\n\t\tdataProcessingCodepath: string,\n\t\tmessageLike?: Partial<\n\t\t\tPick<\n\t\t\t\tISequencedDocumentMessage,\n\t\t\t\t| \"clientId\"\n\t\t\t\t| \"sequenceNumber\"\n\t\t\t\t| \"clientSequenceNumber\"\n\t\t\t\t| \"referenceSequenceNumber\"\n\t\t\t\t| \"minimumSequenceNumber\"\n\t\t\t\t| \"timestamp\"\n\t\t\t>\n\t\t>,\n\t): IFluidErrorBase {\n\t\tconst props = {\n\t\t\tdataProcessingError: 1,\n\t\t\tdataProcessingCodepath,\n\t\t\t...(messageLike === undefined\n\t\t\t\t? undefined\n\t\t\t\t: extractSafePropertiesFromMessage(messageLike)),\n\t\t};\n\n\t\tconst normalizedError = normalizeError(originalError, { props });\n\t\t// Note that other errors may have the NORMALIZED_ERROR_TYPE errorType,\n\t\t// but if so they are still suitable to be wrapped as DataProcessingError.\n\t\tif (\n\t\t\tisExternalError(normalizedError) ||\n\t\t\tnormalizedError.errorType === NORMALIZED_ERROR_TYPE\n\t\t) {\n\t\t\t// Create a new DataProcessingError to wrap this external error\n\t\t\tconst dataProcessingError = wrapError(\n\t\t\t\tnormalizedError,\n\t\t\t\t(message: string) => new DataProcessingError(message),\n\t\t\t);\n\n\t\t\t// Copy over the props above and any others added to this error since first being normalized\n\t\t\tdataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties());\n\n\t\t\treturn dataProcessingError;\n\t\t}\n\t\treturn normalizedError;\n\t}\n}\n\n/**\n * Error indicating that two Fluid layers are incompatible.\n * See {@link @fluidframework/core-interfaces#ILayerIncompatibilityError} for more details.\n *\n * @internal\n */\nexport class LayerIncompatibilityError\n\textends UsageError\n\timplements ILayerIncompatibilityError\n{\n\tpublic [layerIncompatibilityErrorSymbol] = true as const;\n\tpublic readonly layer: string;\n\tpublic readonly layerVersion: string;\n\tpublic readonly incompatibleLayer: string;\n\tpublic readonly incompatibleLayerVersion: string;\n\tpublic readonly compatibilityRequirementsInMonths: number;\n\tpublic readonly actualDifferenceInMonths: number;\n\tpublic readonly details: string;\n\n\tpublic constructor(\n\t\tmessage: string,\n\t\tincompatibilityProps: {\n\t\t\tlayer: string;\n\t\t\tlayerVersion: string;\n\t\t\tincompatibleLayer: string;\n\t\t\tincompatibleLayerVersion: string;\n\t\t\tcompatibilityRequirementsInMonths: number;\n\t\t\tactualDifferenceInMonths: number;\n\t\t\tdetails: string;\n\t\t},\n\t\ttelemetryProps?: ITelemetryBaseProperties,\n\t) {\n\t\tsuper(message, {\n\t\t\t...incompatibilityProps,\n\t\t\t...telemetryProps,\n\t\t\tlayerIncompatibilityError: true,\n\t\t});\n\t\tthis.layer = incompatibilityProps.layer;\n\t\tthis.layerVersion = incompatibilityProps.layerVersion;\n\t\tthis.incompatibleLayer = incompatibilityProps.incompatibleLayer;\n\t\tthis.incompatibleLayerVersion = incompatibilityProps.incompatibleLayerVersion;\n\t\tthis.compatibilityRequirementsInMonths =\n\t\t\tincompatibilityProps.compatibilityRequirementsInMonths;\n\t\tthis.actualDifferenceInMonths = incompatibilityProps.actualDifferenceInMonths;\n\t\tthis.details = incompatibilityProps.details;\n\t}\n}\n\n/**\n * Extracts specific properties from the provided message that we know are safe to log.\n *\n * @param messageLike - Message to include info about via telemetry props.\n *\n * @internal\n */\nexport const extractSafePropertiesFromMessage = (\n\tmessageLike: Partial<\n\t\tPick<\n\t\t\tISequencedDocumentMessage,\n\t\t\t| \"clientId\"\n\t\t\t| \"sequenceNumber\"\n\t\t\t| \"clientSequenceNumber\"\n\t\t\t| \"referenceSequenceNumber\"\n\t\t\t| \"minimumSequenceNumber\"\n\t\t\t| \"timestamp\"\n\t\t>\n\t>,\n): {\n\tmessageClientId: string | undefined;\n\tmessageSequenceNumber: number | undefined;\n\tmessageClientSequenceNumber: number | undefined;\n\tmessageReferenceSequenceNumber: number | undefined;\n\tmessageMinimumSequenceNumber: number | undefined;\n\tmessageTimestamp: number | undefined;\n} => ({\n\tmessageClientId: messageLike.clientId === null ? \"null\" : messageLike.clientId,\n\tmessageSequenceNumber: messageLike.sequenceNumber,\n\tmessageClientSequenceNumber: messageLike.clientSequenceNumber,\n\tmessageReferenceSequenceNumber: messageLike.referenceSequenceNumber,\n\tmessageMinimumSequenceNumber: messageLike.minimumSequenceNumber,\n\tmessageTimestamp: messageLike.timestamp,\n});\n"]}
|
|
1
|
+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EAQA,EAAE,CAAC,CAAC;IACL,eAAe,EAAE,WAAW,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ;IAC9E,qBAAqB,EAAE,WAAW,CAAC,cAAc;IACjD,2BAA2B,EAAE,WAAW,CAAC,oBAAoB;IAC7D,8BAA8B,EAAE,WAAW,CAAC,uBAAuB;IACnE,4BAA4B,EAAE,WAAW,CAAC,qBAAqB;IAC/D,gBAAgB,EAAE,WAAW,CAAC,SAAS;CACvC,CAAC,CAAC;AA1BU,QAAA,gCAAgC,oCA0B1C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IErrorBase, ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidErrorTypes,\n\tFluidErrorTypesAlpha,\n\ttype IGenericError,\n\ttype ILayerIncompatibilityError,\n\ttype IUsageError,\n} from \"@fluidframework/core-interfaces/internal\";\nimport type { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport {\n\tLoggingError,\n\tNORMALIZED_ERROR_TYPE,\n\tisExternalError,\n\tnormalizeError,\n\twrapError,\n} from \"./errorLogging.js\";\nimport type { IFluidErrorBase } from \"./fluidErrorBase.js\";\nimport type { ITelemetryPropertiesExt } from \"./telemetryTypes.js\";\n\n/**\n * Throws a UsageError with the given message if the condition is not met.\n * Use this API when `false` indicates a precondition is not met on a public API (for any FF layer).\n *\n * @param condition - The condition that should be true, if the condition is false a UsageError will be thrown.\n * @param message - The message to include in the error when the condition does not hold.\n * @param props - Telemetry props to include on the error when the condition does not hold.\n * @internal\n */\nexport function validatePrecondition(\n\tcondition: boolean,\n\tmessage: string,\n\tprops?: ITelemetryBaseProperties,\n): asserts condition {\n\tif (!condition) {\n\t\tthrow new UsageError(message, props);\n\t}\n}\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n *\n * @internal\n */\nexport class GenericError extends LoggingError implements IGenericError, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.genericError;\n\n\t/**\n\t * Create a new GenericError\n\t * @param message - Error message\n\t * @param error - inner error object\n\t * @param props - Telemetry props to include when the error is logged\n\t */\n\tpublic constructor(\n\t\tmessage: string,\n\t\t// TODO: Use `unknown` instead (API breaking change because error is not just an input parameter, but a public member of the class)\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\t\tpublic readonly error?: any,\n\t\tprops?: ITelemetryBaseProperties,\n\t) {\n\t\t// Don't try to log the inner error\n\t\tsuper(message, props, new Set([\"error\"]));\n\t}\n}\n\n/**\n * Error indicating an API is being used improperly resulting in an invalid operation.\n *\n * @internal\n */\nexport class UsageError extends LoggingError implements IUsageError, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.usageError;\n\n\tpublic constructor(message: string, props?: ITelemetryBaseProperties) {\n\t\tsuper(message, { ...props, usageError: true });\n\t}\n}\n\n/**\n * DataCorruptionError indicates that we encountered definitive evidence that the data at rest\n * backing this container is corrupted, and this container would never be expected to load properly again\n *\n * @internal\n */\nexport class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.dataCorruptionError;\n\tpublic readonly canRetry = false;\n\n\tpublic constructor(message: string, props: ITelemetryBaseProperties) {\n\t\tsuper(message, { ...props, dataProcessingError: 1 });\n\t}\n}\n\n/**\n * Indicates we hit a fatal error while processing incoming data from the Fluid Service.\n *\n * @remarks\n *\n * The error will often originate in the dataStore or DDS implementation that is responding to incoming changes.\n * This differs from {@link DataCorruptionError} in that this may be a transient error that will not repro in another\n * client or session.\n *\n * @internal\n */\nexport class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\t/**\n\t * {@inheritDoc IFluidErrorBase.errorType}\n\t */\n\tpublic readonly errorType = FluidErrorTypes.dataProcessingError;\n\n\tpublic readonly canRetry = false;\n\n\tprivate constructor(errorMessage: string, props?: ITelemetryBaseProperties) {\n\t\tsuper(errorMessage, props);\n\t}\n\n\t/**\n\t * Create a new `DataProcessingError` detected and raised within the Fluid Framework.\n\t */\n\tpublic static create(\n\t\terrorMessage: string,\n\t\tdataProcessingCodepath: string,\n\t\tsequencedMessage?: ISequencedDocumentMessage,\n\t\tprops: ITelemetryPropertiesExt = {},\n\t\tstackTraceLimit?: number,\n\t): IFluidErrorBase {\n\t\tconst ErrorConfig = Error as unknown as { stackTraceLimit: number };\n\t\tconst originalStackTraceLimit = ErrorConfig.stackTraceLimit;\n\t\ttry {\n\t\t\tif (stackTraceLimit !== undefined) {\n\t\t\t\tErrorConfig.stackTraceLimit = stackTraceLimit;\n\t\t\t}\n\n\t\t\tconst dataProcessingError = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terrorMessage,\n\t\t\t\tdataProcessingCodepath,\n\t\t\t\tsequencedMessage,\n\t\t\t);\n\t\t\tdataProcessingError.addTelemetryProperties(props);\n\n\t\t\treturn dataProcessingError;\n\t\t} finally {\n\t\t\t// Reset the stack trace limit to the original value\n\t\t\tif (stackTraceLimit !== undefined) {\n\t\t\t\tErrorConfig.stackTraceLimit = originalStackTraceLimit;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Wrap the given error in a `DataProcessingError`, unless the error is already of a known type\n\t * with the exception of a normalized {@link LoggingError}, which will still be wrapped.\n\t *\n\t * In either case, the error will have some relevant properties added for telemetry.\n\t *\n\t * @remarks\n\t *\n\t * We wrap conditionally since known error types represent well-understood failure modes, and ideally\n\t * one day we will move away from throwing these errors but rather we'll return them.\n\t * But an unrecognized error needs to be classified as `DataProcessingError`.\n\t *\n\t * @param originalError - The error to be converted.\n\t * @param dataProcessingCodepath - Which code-path failed while processing data.\n\t * @param messageLike - Message to include info about via telemetry props.\n\t *\n\t * @returns Either a new `DataProcessingError`, or (if wrapping is deemed unnecessary) the given error.\n\t */\n\tpublic static wrapIfUnrecognized(\n\t\toriginalError: unknown,\n\t\tdataProcessingCodepath: string,\n\t\tmessageLike?: Partial<\n\t\t\tPick<\n\t\t\t\tISequencedDocumentMessage,\n\t\t\t\t| \"clientId\"\n\t\t\t\t| \"sequenceNumber\"\n\t\t\t\t| \"clientSequenceNumber\"\n\t\t\t\t| \"referenceSequenceNumber\"\n\t\t\t\t| \"minimumSequenceNumber\"\n\t\t\t\t| \"timestamp\"\n\t\t\t>\n\t\t>,\n\t): IFluidErrorBase {\n\t\tconst props = {\n\t\t\tdataProcessingError: 1,\n\t\t\tdataProcessingCodepath,\n\t\t\t...(messageLike === undefined\n\t\t\t\t? undefined\n\t\t\t\t: extractSafePropertiesFromMessage(messageLike)),\n\t\t};\n\n\t\tconst normalizedError = normalizeError(originalError, { props });\n\t\t// Note that other errors may have the NORMALIZED_ERROR_TYPE errorType,\n\t\t// but if so they are still suitable to be wrapped as DataProcessingError.\n\t\tif (\n\t\t\tisExternalError(normalizedError) ||\n\t\t\tnormalizedError.errorType === NORMALIZED_ERROR_TYPE\n\t\t) {\n\t\t\t// Create a new DataProcessingError to wrap this external error\n\t\t\tconst dataProcessingError = wrapError(\n\t\t\t\tnormalizedError,\n\t\t\t\t(message: string) => new DataProcessingError(message),\n\t\t\t);\n\n\t\t\t// Copy over the props above and any others added to this error since first being normalized\n\t\t\tdataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties());\n\n\t\t\treturn dataProcessingError;\n\t\t}\n\t\treturn normalizedError;\n\t}\n}\n\n/**\n * Error indicating that two Fluid layers are incompatible.\n * See {@link @fluidframework/core-interfaces#ILayerIncompatibilityError} for more details.\n *\n * @internal\n */\nexport class LayerIncompatibilityError\n\textends LoggingError\n\timplements ILayerIncompatibilityError\n{\n\tpublic readonly errorType = FluidErrorTypesAlpha.layerIncompatibilityError;\n\tpublic readonly layer: string;\n\tpublic readonly layerVersion: string;\n\tpublic readonly incompatibleLayer: string;\n\tpublic readonly incompatibleLayerVersion: string;\n\tpublic readonly compatibilityRequirementsInMonths: number;\n\tpublic readonly actualDifferenceInMonths: number;\n\tpublic readonly details: string;\n\n\tpublic constructor(\n\t\tmessage: string,\n\t\tincompatibilityProps: {\n\t\t\tlayer: string;\n\t\t\tlayerVersion: string;\n\t\t\tincompatibleLayer: string;\n\t\t\tincompatibleLayerVersion: string;\n\t\t\tcompatibilityRequirementsInMonths: number;\n\t\t\tactualDifferenceInMonths: number;\n\t\t\tdetails: string;\n\t\t},\n\t\ttelemetryProps?: ITelemetryBaseProperties,\n\t) {\n\t\tsuper(message, {\n\t\t\t...incompatibilityProps,\n\t\t\t...telemetryProps,\n\t\t\tlayerIncompatibilityError: true,\n\t\t});\n\t\tthis.layer = incompatibilityProps.layer;\n\t\tthis.layerVersion = incompatibilityProps.layerVersion;\n\t\tthis.incompatibleLayer = incompatibilityProps.incompatibleLayer;\n\t\tthis.incompatibleLayerVersion = incompatibilityProps.incompatibleLayerVersion;\n\t\tthis.compatibilityRequirementsInMonths =\n\t\t\tincompatibilityProps.compatibilityRequirementsInMonths;\n\t\tthis.actualDifferenceInMonths = incompatibilityProps.actualDifferenceInMonths;\n\t\tthis.details = incompatibilityProps.details;\n\t}\n}\n\n/**\n * Extracts specific properties from the provided message that we know are safe to log.\n *\n * @param messageLike - Message to include info about via telemetry props.\n *\n * @internal\n */\nexport const extractSafePropertiesFromMessage = (\n\tmessageLike: Partial<\n\t\tPick<\n\t\t\tISequencedDocumentMessage,\n\t\t\t| \"clientId\"\n\t\t\t| \"sequenceNumber\"\n\t\t\t| \"clientSequenceNumber\"\n\t\t\t| \"referenceSequenceNumber\"\n\t\t\t| \"minimumSequenceNumber\"\n\t\t\t| \"timestamp\"\n\t\t>\n\t>,\n): {\n\tmessageClientId: string | undefined;\n\tmessageSequenceNumber: number | undefined;\n\tmessageClientSequenceNumber: number | undefined;\n\tmessageReferenceSequenceNumber: number | undefined;\n\tmessageMinimumSequenceNumber: number | undefined;\n\tmessageTimestamp: number | undefined;\n} => ({\n\tmessageClientId: messageLike.clientId === null ? \"null\" : messageLike.clientId,\n\tmessageSequenceNumber: messageLike.sequenceNumber,\n\tmessageClientSequenceNumber: messageLike.clientSequenceNumber,\n\tmessageReferenceSequenceNumber: messageLike.referenceSequenceNumber,\n\tmessageMinimumSequenceNumber: messageLike.minimumSequenceNumber,\n\tmessageTimestamp: messageLike.timestamp,\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidErrorBase.d.ts","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"fluidErrorBase.d.ts","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAEN,KAAK,0BAA0B,EAC/B,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,sBAAsB,IAAI,wBAAwB,CAAC;IAEnD;;OAEG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;CACjE;AAMD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,MAAO,OAAO;qBAA2B,MAAM;CACG,CAAC;AAElF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAOrE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAC1C,KAAK,EAAE,OAAO,GACZ,KAAK,IAAI,0BAA0B,CAIrC"}
|
package/dist/fluidErrorBase.js
CHANGED
|
@@ -33,9 +33,7 @@ exports.isFluidError = isFluidError;
|
|
|
33
33
|
* @internal
|
|
34
34
|
*/
|
|
35
35
|
function isLayerIncompatibilityError(error) {
|
|
36
|
-
return (isFluidError(error) &&
|
|
37
|
-
error.errorType === internal_1.FluidErrorTypes.usageError &&
|
|
38
|
-
internal_1.layerIncompatibilityErrorSymbol in error);
|
|
36
|
+
return (isFluidError(error) && error.errorType === internal_1.FluidErrorTypesAlpha.layerIncompatibilityError);
|
|
39
37
|
}
|
|
40
38
|
exports.isLayerIncompatibilityError = isLayerIncompatibilityError;
|
|
41
39
|
//# sourceMappingURL=fluidErrorBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidErrorBase.js","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,
|
|
1
|
+
{"version":3,"file":"fluidErrorBase.js","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uEAGkD;AAkFlD,MAAM,yBAAyB,GAAG,CAAC,CAAU,EAAW,EAAE,CACzD,OAAQ,CAA8B,EAAE,sBAAsB,KAAK,UAAU;IAC7E,OAAQ,CAA8B,EAAE,sBAAsB,KAAK,UAAU,CAAC;AAE/E;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,CAAU,EAAoC,EAAE,CAClF,OAAQ,CAA0C,EAAE,eAAe,KAAK,QAAQ,CAAC;AADrE,QAAA,kBAAkB,sBACmD;AAElF;;;;GAIG;AACH,SAAgB,YAAY,CAAC,KAAc;IAC1C,OAAO,CACN,OAAQ,KAAkC,EAAE,SAAS,KAAK,QAAQ;QAClE,OAAQ,KAAkC,EAAE,OAAO,KAAK,QAAQ;QAChE,IAAA,0BAAkB,EAAC,KAAK,CAAC;QACzB,yBAAyB,CAAC,KAAK,CAAC,CAChC,CAAC;AACH,CAAC;AAPD,oCAOC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CAC1C,KAAc;IAEd,OAAO,CACN,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,SAAS,KAAK,+BAAoB,CAAC,yBAAyB,CACzF,CAAC;AACH,CAAC;AAND,kEAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidErrorTypesAlpha,\n\ttype ILayerIncompatibilityError,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type { ITelemetryPropertiesExt } from \"./telemetryTypes.js\";\n\n/**\n * An error emitted by the Fluid Framework.\n *\n * @remarks\n *\n * All normalized errors flowing through the Fluid Framework adhere to this readonly interface.\n *\n * It features the members of {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | Error}\n * made readonly, as well as {@link IFluidErrorBase.errorType} and {@link IFluidErrorBase.errorInstanceId}.\n * It also features getters and setters for telemetry props to be included when the error is logged.\n *\n * @internal\n */\nexport interface IFluidErrorBase extends Error {\n\t/**\n\t * Classification of what type of error this is.\n\t *\n\t * @remarks Used programmatically by consumers to interpret the error.\n\t */\n\treadonly errorType: string;\n\n\t/**\n\t * Error's message property, made readonly.\n\t *\n\t * @remarks\n\t *\n\t * Recommendations:\n\t *\n\t * Be specific, but also take care when including variable data to consider suitability for aggregation in telemetry.\n\t * Also avoid including any data that jeopardizes the user's privacy. Add a tagged telemetry property instead.\n\t */\n\treadonly message: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack}.\n\t */\n\treadonly stack?: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name}.\n\t */\n\treadonly name: string;\n\n\t/**\n\t * A Guid identifying this error instance.\n\t *\n\t * @remarks\n\t *\n\t * Useful in telemetry for deduplicating multiple logging events arising from the same error,\n\t * or correlating an error with an inner error that caused it, in case of error wrapping.\n\t */\n\treadonly errorInstanceId: string;\n\n\t/**\n\t * When present, inner error that caused this error.\n\t *\n\t * @remarks\n\t * This will often be an {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}, but could be any type.\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause\n\t *\n\t * @privateRemarks\n\t * The \"cause\" field is added in ES2022. Using it even without that built-in support, is still helpful.\n\t * TODO: remove this declaration (use `Error.cause` property) when targeting ES2022 lib or later.\n\t */\n\tcause?: unknown;\n\n\t/**\n\t * Get the telemetry properties stashed on this error for logging.\n\t */\n\tgetTelemetryProperties(): ITelemetryBaseProperties;\n\n\t/**\n\t * Add telemetry properties to this error which will be logged with the error\n\t */\n\taddTelemetryProperties: (props: ITelemetryPropertiesExt) => void;\n}\n\nconst hasTelemetryPropFunctions = (x: unknown): boolean =>\n\ttypeof (x as Partial<IFluidErrorBase>)?.getTelemetryProperties === \"function\" &&\n\ttypeof (x as Partial<IFluidErrorBase>)?.addTelemetryProperties === \"function\";\n\n/**\n * Type guard for error data containing the {@link IFluidErrorBase.errorInstanceId} property.\n *\n * @internal\n */\nexport const hasErrorInstanceId = (x: unknown): x is { errorInstanceId: string } =>\n\ttypeof (x as Partial<{ errorInstanceId: string }>)?.errorInstanceId === \"string\";\n\n/**\n * Type guard for {@link IFluidErrorBase}.\n *\n * @internal\n */\nexport function isFluidError(error: unknown): error is IFluidErrorBase {\n\treturn (\n\t\ttypeof (error as Partial<IFluidErrorBase>)?.errorType === \"string\" &&\n\t\ttypeof (error as Partial<IFluidErrorBase>)?.message === \"string\" &&\n\t\thasErrorInstanceId(error) &&\n\t\thasTelemetryPropFunctions(error)\n\t);\n}\n\n/**\n * Helper that returns whether the provided error is a layer incompatibility error.\n *\n * @internal\n */\nexport function isLayerIncompatibilityError(\n\terror: unknown,\n): error is ILayerIncompatibilityError {\n\treturn (\n\t\tisFluidError(error) && error.errorType === FluidErrorTypesAlpha.layerIncompatibilityError\n\t);\n}\n"]}
|
package/lib/error.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import type { IErrorBase, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
6
|
-
import {
|
|
6
|
+
import { type IGenericError, type ILayerIncompatibilityError, type IUsageError } from "@fluidframework/core-interfaces/internal";
|
|
7
7
|
import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
8
8
|
import { LoggingError } from "./errorLogging.js";
|
|
9
9
|
import type { IFluidErrorBase } from "./fluidErrorBase.js";
|
|
@@ -102,8 +102,8 @@ export declare class DataProcessingError extends LoggingError implements IErrorB
|
|
|
102
102
|
*
|
|
103
103
|
* @internal
|
|
104
104
|
*/
|
|
105
|
-
export declare class LayerIncompatibilityError extends
|
|
106
|
-
|
|
105
|
+
export declare class LayerIncompatibilityError extends LoggingError implements ILayerIncompatibilityError {
|
|
106
|
+
readonly errorType: "layerIncompatibilityError";
|
|
107
107
|
readonly layer: string;
|
|
108
108
|
readonly layerVersion: string;
|
|
109
109
|
readonly incompatibleLayer: string;
|
package/lib/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EA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AwB,EAAE,MAAM,CAAC;QACjC,OAAO,EAAE,MAAM,CAAC;KAChB,EACD,cAAc,CAAC,EAAE,wBAAwB;CAgB1C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,gBAC/B,QACZ,KACC,yBAAyB,EACvB,UAAU,GACV,gBAAgB,GAChB,sBAAsB,GACtB,yBAAyB,GACzB,uBAAuB,GACvB,WAAW,CACb,CACD,KACC;IACF,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,2BAA2B,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,8BAA8B,EAAE,MAAM,GAAG,SAAS,CAAC;IACnD,4BAA4B,EAAE,MAAM,GAAG,SAAS,CAAC;IACjD,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CAQpC,CAAC"}
|
package/lib/error.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
import { FluidErrorTypes, layerIncompatibilityErrorSymbol, } from "@fluidframework/core-interfaces/internal";
|
|
5
|
+
import { FluidErrorTypes, FluidErrorTypesAlpha, } from "@fluidframework/core-interfaces/internal";
|
|
7
6
|
import { LoggingError, NORMALIZED_ERROR_TYPE, isExternalError, normalizeError, wrapError, } from "./errorLogging.js";
|
|
8
7
|
/**
|
|
9
8
|
* Throws a UsageError with the given message if the condition is not met.
|
|
@@ -152,14 +151,14 @@ export class DataProcessingError extends LoggingError {
|
|
|
152
151
|
*
|
|
153
152
|
* @internal
|
|
154
153
|
*/
|
|
155
|
-
export class LayerIncompatibilityError extends
|
|
154
|
+
export class LayerIncompatibilityError extends LoggingError {
|
|
156
155
|
constructor(message, incompatibilityProps, telemetryProps) {
|
|
157
156
|
super(message, {
|
|
158
157
|
...incompatibilityProps,
|
|
159
158
|
...telemetryProps,
|
|
160
159
|
layerIncompatibilityError: true,
|
|
161
160
|
});
|
|
162
|
-
this
|
|
161
|
+
this.errorType = FluidErrorTypesAlpha.layerIncompatibilityError;
|
|
163
162
|
this.layer = incompatibilityProps.layer;
|
|
164
163
|
this.layerVersion = incompatibilityProps.layerVersion;
|
|
165
164
|
this.incompatibleLayer = incompatibilityProps.incompatibleLayer;
|
|
@@ -170,7 +169,6 @@ export class LayerIncompatibilityError extends UsageError {
|
|
|
170
169
|
this.details = incompatibilityProps.details;
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
|
-
_a = layerIncompatibilityErrorSymbol;
|
|
174
172
|
/**
|
|
175
173
|
* Extracts specific properties from the provided message that we know are safe to log.
|
|
176
174
|
*
|
package/lib/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EACN,eAAe,EACf,+BAA+B,GAI/B,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EACN,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,SAAS,GACT,MAAM,mBAAmB,CAAC;AAI3B;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CACnC,SAAkB,EAClB,OAAe,EACf,KAAgC;IAEhC,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;AACF,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,YAAa,SAAQ,YAAY;IAG7C;;;;;OAKG;IACH,YACC,OAAe;IACf,mIAAmI;IACnI,iHAAiH;IACjG,KAAW,EAC3B,KAAgC;QAEhC,mCAAmC;QACnC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAJ1B,UAAK,GAAL,KAAK,CAA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,CAAC,CAAC;QA1BG,QAAiC,GAAG,IAAa,CAAC;QA2BxD,IAAI,CAAC,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,oBAAoB,CAAC,YAAY,CAAC;QACtD,IAAI,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC;QAChE,IAAI,CAAC,wBAAwB,GAAG,oBAAoB,CAAC,wBAAwB,CAAC;QAC9E,IAAI,CAAC,iCAAiC;YACrC,oBAAoB,CAAC,iCAAiC,CAAC;QACxD,IAAI,CAAC,wBAAwB,GAAG,oBAAoB,CAAC,wBAAwB,CAAC;QAC9E,IAAI,CAAC,OAAO,GAAG,oBAAoB,CAAC,OAAO,CAAC;IAC7C,CAAC;CACD;KApCQ,+BAA+B;AAsCxC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC/C,WAUC,EAQA,EAAE,CAAC,CAAC;IACL,eAAe,EAAE,WAAW,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ;IAC9E,qBAAqB,EAAE,WAAW,CAAC,cAAc;IACjD,2BAA2B,EAAE,WAAW,CAAC,oBAAoB;IAC7D,8BAA8B,EAAE,WAAW,CAAC,uBAAuB;IACnE,4BAA4B,EAAE,WAAW,CAAC,qBAAqB;IAC/D,gBAAgB,EAAE,WAAW,CAAC,SAAS;CACvC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IErrorBase, ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidErrorTypes,\n\tlayerIncompatibilityErrorSymbol,\n\ttype IGenericError,\n\ttype ILayerIncompatibilityError,\n\ttype IUsageError,\n} from \"@fluidframework/core-interfaces/internal\";\nimport type { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport {\n\tLoggingError,\n\tNORMALIZED_ERROR_TYPE,\n\tisExternalError,\n\tnormalizeError,\n\twrapError,\n} from \"./errorLogging.js\";\nimport type { IFluidErrorBase } from \"./fluidErrorBase.js\";\nimport type { ITelemetryPropertiesExt } from \"./telemetryTypes.js\";\n\n/**\n * Throws a UsageError with the given message if the condition is not met.\n * Use this API when `false` indicates a precondition is not met on a public API (for any FF layer).\n *\n * @param condition - The condition that should be true, if the condition is false a UsageError will be thrown.\n * @param message - The message to include in the error when the condition does not hold.\n * @param props - Telemetry props to include on the error when the condition does not hold.\n * @internal\n */\nexport function validatePrecondition(\n\tcondition: boolean,\n\tmessage: string,\n\tprops?: ITelemetryBaseProperties,\n): asserts condition {\n\tif (!condition) {\n\t\tthrow new UsageError(message, props);\n\t}\n}\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n *\n * @internal\n */\nexport class GenericError extends LoggingError implements IGenericError, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.genericError;\n\n\t/**\n\t * Create a new GenericError\n\t * @param message - Error message\n\t * @param error - inner error object\n\t * @param props - Telemetry props to include when the error is logged\n\t */\n\tpublic constructor(\n\t\tmessage: string,\n\t\t// TODO: Use `unknown` instead (API breaking change because error is not just an input parameter, but a public member of the class)\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\t\tpublic readonly error?: any,\n\t\tprops?: ITelemetryBaseProperties,\n\t) {\n\t\t// Don't try to log the inner error\n\t\tsuper(message, props, new Set([\"error\"]));\n\t}\n}\n\n/**\n * Error indicating an API is being used improperly resulting in an invalid operation.\n *\n * @internal\n */\nexport class UsageError extends LoggingError implements IUsageError, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.usageError;\n\n\tpublic constructor(message: string, props?: ITelemetryBaseProperties) {\n\t\tsuper(message, { ...props, usageError: true });\n\t}\n}\n\n/**\n * DataCorruptionError indicates that we encountered definitive evidence that the data at rest\n * backing this container is corrupted, and this container would never be expected to load properly again\n *\n * @internal\n */\nexport class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.dataCorruptionError;\n\tpublic readonly canRetry = false;\n\n\tpublic constructor(message: string, props: ITelemetryBaseProperties) {\n\t\tsuper(message, { ...props, dataProcessingError: 1 });\n\t}\n}\n\n/**\n * Indicates we hit a fatal error while processing incoming data from the Fluid Service.\n *\n * @remarks\n *\n * The error will often originate in the dataStore or DDS implementation that is responding to incoming changes.\n * This differs from {@link DataCorruptionError} in that this may be a transient error that will not repro in another\n * client or session.\n *\n * @internal\n */\nexport class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\t/**\n\t * {@inheritDoc IFluidErrorBase.errorType}\n\t */\n\tpublic readonly errorType = FluidErrorTypes.dataProcessingError;\n\n\tpublic readonly canRetry = false;\n\n\tprivate constructor(errorMessage: string, props?: ITelemetryBaseProperties) {\n\t\tsuper(errorMessage, props);\n\t}\n\n\t/**\n\t * Create a new `DataProcessingError` detected and raised within the Fluid Framework.\n\t */\n\tpublic static create(\n\t\terrorMessage: string,\n\t\tdataProcessingCodepath: string,\n\t\tsequencedMessage?: ISequencedDocumentMessage,\n\t\tprops: ITelemetryPropertiesExt = {},\n\t\tstackTraceLimit?: number,\n\t): IFluidErrorBase {\n\t\tconst ErrorConfig = Error as unknown as { stackTraceLimit: number };\n\t\tconst originalStackTraceLimit = ErrorConfig.stackTraceLimit;\n\t\ttry {\n\t\t\tif (stackTraceLimit !== undefined) {\n\t\t\t\tErrorConfig.stackTraceLimit = stackTraceLimit;\n\t\t\t}\n\n\t\t\tconst dataProcessingError = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terrorMessage,\n\t\t\t\tdataProcessingCodepath,\n\t\t\t\tsequencedMessage,\n\t\t\t);\n\t\t\tdataProcessingError.addTelemetryProperties(props);\n\n\t\t\treturn dataProcessingError;\n\t\t} finally {\n\t\t\t// Reset the stack trace limit to the original value\n\t\t\tif (stackTraceLimit !== undefined) {\n\t\t\t\tErrorConfig.stackTraceLimit = originalStackTraceLimit;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Wrap the given error in a `DataProcessingError`, unless the error is already of a known type\n\t * with the exception of a normalized {@link LoggingError}, which will still be wrapped.\n\t *\n\t * In either case, the error will have some relevant properties added for telemetry.\n\t *\n\t * @remarks\n\t *\n\t * We wrap conditionally since known error types represent well-understood failure modes, and ideally\n\t * one day we will move away from throwing these errors but rather we'll return them.\n\t * But an unrecognized error needs to be classified as `DataProcessingError`.\n\t *\n\t * @param originalError - The error to be converted.\n\t * @param dataProcessingCodepath - Which code-path failed while processing data.\n\t * @param messageLike - Message to include info about via telemetry props.\n\t *\n\t * @returns Either a new `DataProcessingError`, or (if wrapping is deemed unnecessary) the given error.\n\t */\n\tpublic static wrapIfUnrecognized(\n\t\toriginalError: unknown,\n\t\tdataProcessingCodepath: string,\n\t\tmessageLike?: Partial<\n\t\t\tPick<\n\t\t\t\tISequencedDocumentMessage,\n\t\t\t\t| \"clientId\"\n\t\t\t\t| \"sequenceNumber\"\n\t\t\t\t| \"clientSequenceNumber\"\n\t\t\t\t| \"referenceSequenceNumber\"\n\t\t\t\t| \"minimumSequenceNumber\"\n\t\t\t\t| \"timestamp\"\n\t\t\t>\n\t\t>,\n\t): IFluidErrorBase {\n\t\tconst props = {\n\t\t\tdataProcessingError: 1,\n\t\t\tdataProcessingCodepath,\n\t\t\t...(messageLike === undefined\n\t\t\t\t? undefined\n\t\t\t\t: extractSafePropertiesFromMessage(messageLike)),\n\t\t};\n\n\t\tconst normalizedError = normalizeError(originalError, { props });\n\t\t// Note that other errors may have the NORMALIZED_ERROR_TYPE errorType,\n\t\t// but if so they are still suitable to be wrapped as DataProcessingError.\n\t\tif (\n\t\t\tisExternalError(normalizedError) ||\n\t\t\tnormalizedError.errorType === NORMALIZED_ERROR_TYPE\n\t\t) {\n\t\t\t// Create a new DataProcessingError to wrap this external error\n\t\t\tconst dataProcessingError = wrapError(\n\t\t\t\tnormalizedError,\n\t\t\t\t(message: string) => new DataProcessingError(message),\n\t\t\t);\n\n\t\t\t// Copy over the props above and any others added to this error since first being normalized\n\t\t\tdataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties());\n\n\t\t\treturn dataProcessingError;\n\t\t}\n\t\treturn normalizedError;\n\t}\n}\n\n/**\n * Error indicating that two Fluid layers are incompatible.\n * See {@link @fluidframework/core-interfaces#ILayerIncompatibilityError} for more details.\n *\n * @internal\n */\nexport class LayerIncompatibilityError\n\textends UsageError\n\timplements ILayerIncompatibilityError\n{\n\tpublic [layerIncompatibilityErrorSymbol] = true as const;\n\tpublic readonly layer: string;\n\tpublic readonly layerVersion: string;\n\tpublic readonly incompatibleLayer: string;\n\tpublic readonly incompatibleLayerVersion: string;\n\tpublic readonly compatibilityRequirementsInMonths: number;\n\tpublic readonly actualDifferenceInMonths: number;\n\tpublic readonly details: string;\n\n\tpublic constructor(\n\t\tmessage: string,\n\t\tincompatibilityProps: {\n\t\t\tlayer: string;\n\t\t\tlayerVersion: string;\n\t\t\tincompatibleLayer: string;\n\t\t\tincompatibleLayerVersion: string;\n\t\t\tcompatibilityRequirementsInMonths: number;\n\t\t\tactualDifferenceInMonths: number;\n\t\t\tdetails: string;\n\t\t},\n\t\ttelemetryProps?: ITelemetryBaseProperties,\n\t) {\n\t\tsuper(message, {\n\t\t\t...incompatibilityProps,\n\t\t\t...telemetryProps,\n\t\t\tlayerIncompatibilityError: true,\n\t\t});\n\t\tthis.layer = incompatibilityProps.layer;\n\t\tthis.layerVersion = incompatibilityProps.layerVersion;\n\t\tthis.incompatibleLayer = incompatibilityProps.incompatibleLayer;\n\t\tthis.incompatibleLayerVersion = incompatibilityProps.incompatibleLayerVersion;\n\t\tthis.compatibilityRequirementsInMonths =\n\t\t\tincompatibilityProps.compatibilityRequirementsInMonths;\n\t\tthis.actualDifferenceInMonths = incompatibilityProps.actualDifferenceInMonths;\n\t\tthis.details = incompatibilityProps.details;\n\t}\n}\n\n/**\n * Extracts specific properties from the provided message that we know are safe to log.\n *\n * @param messageLike - Message to include info about via telemetry props.\n *\n * @internal\n */\nexport const extractSafePropertiesFromMessage = (\n\tmessageLike: Partial<\n\t\tPick<\n\t\t\tISequencedDocumentMessage,\n\t\t\t| \"clientId\"\n\t\t\t| \"sequenceNumber\"\n\t\t\t| \"clientSequenceNumber\"\n\t\t\t| \"referenceSequenceNumber\"\n\t\t\t| \"minimumSequenceNumber\"\n\t\t\t| \"timestamp\"\n\t\t>\n\t>,\n): {\n\tmessageClientId: string | undefined;\n\tmessageSequenceNumber: number | undefined;\n\tmessageClientSequenceNumber: number | undefined;\n\tmessageReferenceSequenceNumber: number | undefined;\n\tmessageMinimumSequenceNumber: number | undefined;\n\tmessageTimestamp: number | undefined;\n} => ({\n\tmessageClientId: messageLike.clientId === null ? \"null\" : messageLike.clientId,\n\tmessageSequenceNumber: messageLike.sequenceNumber,\n\tmessageClientSequenceNumber: messageLike.clientSequenceNumber,\n\tmessageReferenceSequenceNumber: messageLike.referenceSequenceNumber,\n\tmessageMinimumSequenceNumber: messageLike.minimumSequenceNumber,\n\tmessageTimestamp: messageLike.timestamp,\n});\n"]}
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,eAAe,EACf,oBAAoB,GAIpB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EACN,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,SAAS,GACT,MAAM,mBAAmB,CAAC;AAI3B;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CACnC,SAAkB,EAClB,OAAe,EACf,KAAgC;IAEhC,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,MAAM,IAAI,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;AACF,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,YAAa,S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n */\n\nimport type { IErrorBase, ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidErrorTypes,\n\tFluidErrorTypesAlpha,\n\ttype IGenericError,\n\ttype ILayerIncompatibilityError,\n\ttype IUsageError,\n} from \"@fluidframework/core-interfaces/internal\";\nimport type { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport {\n\tLoggingError,\n\tNORMALIZED_ERROR_TYPE,\n\tisExternalError,\n\tnormalizeError,\n\twrapError,\n} from \"./errorLogging.js\";\nimport type { IFluidErrorBase } from \"./fluidErrorBase.js\";\nimport type { ITelemetryPropertiesExt } from \"./telemetryTypes.js\";\n\n/**\n * Throws a UsageError with the given message if the condition is not met.\n * Use this API when `false` indicates a precondition is not met on a public API (for any FF layer).\n *\n * @param condition - The condition that should be true, if the condition is false a UsageError will be thrown.\n * @param message - The message to include in the error when the condition does not hold.\n * @param props - Telemetry props to include on the error when the condition does not hold.\n * @internal\n */\nexport function validatePrecondition(\n\tcondition: boolean,\n\tmessage: string,\n\tprops?: ITelemetryBaseProperties,\n): asserts condition {\n\tif (!condition) {\n\t\tthrow new UsageError(message, props);\n\t}\n}\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n *\n * @internal\n */\nexport class GenericError extends LoggingError implements IGenericError, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.genericError;\n\n\t/**\n\t * Create a new GenericError\n\t * @param message - Error message\n\t * @param error - inner error object\n\t * @param props - Telemetry props to include when the error is logged\n\t */\n\tpublic constructor(\n\t\tmessage: string,\n\t\t// TODO: Use `unknown` instead (API breaking change because error is not just an input parameter, but a public member of the class)\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\t\tpublic readonly error?: any,\n\t\tprops?: ITelemetryBaseProperties,\n\t) {\n\t\t// Don't try to log the inner error\n\t\tsuper(message, props, new Set([\"error\"]));\n\t}\n}\n\n/**\n * Error indicating an API is being used improperly resulting in an invalid operation.\n *\n * @internal\n */\nexport class UsageError extends LoggingError implements IUsageError, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.usageError;\n\n\tpublic constructor(message: string, props?: ITelemetryBaseProperties) {\n\t\tsuper(message, { ...props, usageError: true });\n\t}\n}\n\n/**\n * DataCorruptionError indicates that we encountered definitive evidence that the data at rest\n * backing this container is corrupted, and this container would never be expected to load properly again\n *\n * @internal\n */\nexport class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\tpublic readonly errorType = FluidErrorTypes.dataCorruptionError;\n\tpublic readonly canRetry = false;\n\n\tpublic constructor(message: string, props: ITelemetryBaseProperties) {\n\t\tsuper(message, { ...props, dataProcessingError: 1 });\n\t}\n}\n\n/**\n * Indicates we hit a fatal error while processing incoming data from the Fluid Service.\n *\n * @remarks\n *\n * The error will often originate in the dataStore or DDS implementation that is responding to incoming changes.\n * This differs from {@link DataCorruptionError} in that this may be a transient error that will not repro in another\n * client or session.\n *\n * @internal\n */\nexport class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\t/**\n\t * {@inheritDoc IFluidErrorBase.errorType}\n\t */\n\tpublic readonly errorType = FluidErrorTypes.dataProcessingError;\n\n\tpublic readonly canRetry = false;\n\n\tprivate constructor(errorMessage: string, props?: ITelemetryBaseProperties) {\n\t\tsuper(errorMessage, props);\n\t}\n\n\t/**\n\t * Create a new `DataProcessingError` detected and raised within the Fluid Framework.\n\t */\n\tpublic static create(\n\t\terrorMessage: string,\n\t\tdataProcessingCodepath: string,\n\t\tsequencedMessage?: ISequencedDocumentMessage,\n\t\tprops: ITelemetryPropertiesExt = {},\n\t\tstackTraceLimit?: number,\n\t): IFluidErrorBase {\n\t\tconst ErrorConfig = Error as unknown as { stackTraceLimit: number };\n\t\tconst originalStackTraceLimit = ErrorConfig.stackTraceLimit;\n\t\ttry {\n\t\t\tif (stackTraceLimit !== undefined) {\n\t\t\t\tErrorConfig.stackTraceLimit = stackTraceLimit;\n\t\t\t}\n\n\t\t\tconst dataProcessingError = DataProcessingError.wrapIfUnrecognized(\n\t\t\t\terrorMessage,\n\t\t\t\tdataProcessingCodepath,\n\t\t\t\tsequencedMessage,\n\t\t\t);\n\t\t\tdataProcessingError.addTelemetryProperties(props);\n\n\t\t\treturn dataProcessingError;\n\t\t} finally {\n\t\t\t// Reset the stack trace limit to the original value\n\t\t\tif (stackTraceLimit !== undefined) {\n\t\t\t\tErrorConfig.stackTraceLimit = originalStackTraceLimit;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Wrap the given error in a `DataProcessingError`, unless the error is already of a known type\n\t * with the exception of a normalized {@link LoggingError}, which will still be wrapped.\n\t *\n\t * In either case, the error will have some relevant properties added for telemetry.\n\t *\n\t * @remarks\n\t *\n\t * We wrap conditionally since known error types represent well-understood failure modes, and ideally\n\t * one day we will move away from throwing these errors but rather we'll return them.\n\t * But an unrecognized error needs to be classified as `DataProcessingError`.\n\t *\n\t * @param originalError - The error to be converted.\n\t * @param dataProcessingCodepath - Which code-path failed while processing data.\n\t * @param messageLike - Message to include info about via telemetry props.\n\t *\n\t * @returns Either a new `DataProcessingError`, or (if wrapping is deemed unnecessary) the given error.\n\t */\n\tpublic static wrapIfUnrecognized(\n\t\toriginalError: unknown,\n\t\tdataProcessingCodepath: string,\n\t\tmessageLike?: Partial<\n\t\t\tPick<\n\t\t\t\tISequencedDocumentMessage,\n\t\t\t\t| \"clientId\"\n\t\t\t\t| \"sequenceNumber\"\n\t\t\t\t| \"clientSequenceNumber\"\n\t\t\t\t| \"referenceSequenceNumber\"\n\t\t\t\t| \"minimumSequenceNumber\"\n\t\t\t\t| \"timestamp\"\n\t\t\t>\n\t\t>,\n\t): IFluidErrorBase {\n\t\tconst props = {\n\t\t\tdataProcessingError: 1,\n\t\t\tdataProcessingCodepath,\n\t\t\t...(messageLike === undefined\n\t\t\t\t? undefined\n\t\t\t\t: extractSafePropertiesFromMessage(messageLike)),\n\t\t};\n\n\t\tconst normalizedError = normalizeError(originalError, { props });\n\t\t// Note that other errors may have the NORMALIZED_ERROR_TYPE errorType,\n\t\t// but if so they are still suitable to be wrapped as DataProcessingError.\n\t\tif (\n\t\t\tisExternalError(normalizedError) ||\n\t\t\tnormalizedError.errorType === NORMALIZED_ERROR_TYPE\n\t\t) {\n\t\t\t// Create a new DataProcessingError to wrap this external error\n\t\t\tconst dataProcessingError = wrapError(\n\t\t\t\tnormalizedError,\n\t\t\t\t(message: string) => new DataProcessingError(message),\n\t\t\t);\n\n\t\t\t// Copy over the props above and any others added to this error since first being normalized\n\t\t\tdataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties());\n\n\t\t\treturn dataProcessingError;\n\t\t}\n\t\treturn normalizedError;\n\t}\n}\n\n/**\n * Error indicating that two Fluid layers are incompatible.\n * See {@link @fluidframework/core-interfaces#ILayerIncompatibilityError} for more details.\n *\n * @internal\n */\nexport class LayerIncompatibilityError\n\textends LoggingError\n\timplements ILayerIncompatibilityError\n{\n\tpublic readonly errorType = FluidErrorTypesAlpha.layerIncompatibilityError;\n\tpublic readonly layer: string;\n\tpublic readonly layerVersion: string;\n\tpublic readonly incompatibleLayer: string;\n\tpublic readonly incompatibleLayerVersion: string;\n\tpublic readonly compatibilityRequirementsInMonths: number;\n\tpublic readonly actualDifferenceInMonths: number;\n\tpublic readonly details: string;\n\n\tpublic constructor(\n\t\tmessage: string,\n\t\tincompatibilityProps: {\n\t\t\tlayer: string;\n\t\t\tlayerVersion: string;\n\t\t\tincompatibleLayer: string;\n\t\t\tincompatibleLayerVersion: string;\n\t\t\tcompatibilityRequirementsInMonths: number;\n\t\t\tactualDifferenceInMonths: number;\n\t\t\tdetails: string;\n\t\t},\n\t\ttelemetryProps?: ITelemetryBaseProperties,\n\t) {\n\t\tsuper(message, {\n\t\t\t...incompatibilityProps,\n\t\t\t...telemetryProps,\n\t\t\tlayerIncompatibilityError: true,\n\t\t});\n\t\tthis.layer = incompatibilityProps.layer;\n\t\tthis.layerVersion = incompatibilityProps.layerVersion;\n\t\tthis.incompatibleLayer = incompatibilityProps.incompatibleLayer;\n\t\tthis.incompatibleLayerVersion = incompatibilityProps.incompatibleLayerVersion;\n\t\tthis.compatibilityRequirementsInMonths =\n\t\t\tincompatibilityProps.compatibilityRequirementsInMonths;\n\t\tthis.actualDifferenceInMonths = incompatibilityProps.actualDifferenceInMonths;\n\t\tthis.details = incompatibilityProps.details;\n\t}\n}\n\n/**\n * Extracts specific properties from the provided message that we know are safe to log.\n *\n * @param messageLike - Message to include info about via telemetry props.\n *\n * @internal\n */\nexport const extractSafePropertiesFromMessage = (\n\tmessageLike: Partial<\n\t\tPick<\n\t\t\tISequencedDocumentMessage,\n\t\t\t| \"clientId\"\n\t\t\t| \"sequenceNumber\"\n\t\t\t| \"clientSequenceNumber\"\n\t\t\t| \"referenceSequenceNumber\"\n\t\t\t| \"minimumSequenceNumber\"\n\t\t\t| \"timestamp\"\n\t\t>\n\t>,\n): {\n\tmessageClientId: string | undefined;\n\tmessageSequenceNumber: number | undefined;\n\tmessageClientSequenceNumber: number | undefined;\n\tmessageReferenceSequenceNumber: number | undefined;\n\tmessageMinimumSequenceNumber: number | undefined;\n\tmessageTimestamp: number | undefined;\n} => ({\n\tmessageClientId: messageLike.clientId === null ? \"null\" : messageLike.clientId,\n\tmessageSequenceNumber: messageLike.sequenceNumber,\n\tmessageClientSequenceNumber: messageLike.clientSequenceNumber,\n\tmessageReferenceSequenceNumber: messageLike.referenceSequenceNumber,\n\tmessageMinimumSequenceNumber: messageLike.minimumSequenceNumber,\n\tmessageTimestamp: messageLike.timestamp,\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidErrorBase.d.ts","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,
|
|
1
|
+
{"version":3,"file":"fluidErrorBase.d.ts","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAEN,KAAK,0BAA0B,EAC/B,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAgB,SAAQ,KAAK;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,sBAAsB,IAAI,wBAAwB,CAAC;IAEnD;;OAEG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;CACjE;AAMD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,MAAO,OAAO;qBAA2B,MAAM;CACG,CAAC;AAElF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAOrE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAC1C,KAAK,EAAE,OAAO,GACZ,KAAK,IAAI,0BAA0B,CAIrC"}
|
package/lib/fluidErrorBase.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { FluidErrorTypesAlpha, } from "@fluidframework/core-interfaces/internal";
|
|
6
6
|
const hasTelemetryPropFunctions = (x) => typeof x?.getTelemetryProperties === "function" &&
|
|
7
7
|
typeof x?.addTelemetryProperties === "function";
|
|
8
8
|
/**
|
|
@@ -28,8 +28,6 @@ export function isFluidError(error) {
|
|
|
28
28
|
* @internal
|
|
29
29
|
*/
|
|
30
30
|
export function isLayerIncompatibilityError(error) {
|
|
31
|
-
return (isFluidError(error) &&
|
|
32
|
-
error.errorType === FluidErrorTypes.usageError &&
|
|
33
|
-
layerIncompatibilityErrorSymbol in error);
|
|
31
|
+
return (isFluidError(error) && error.errorType === FluidErrorTypesAlpha.layerIncompatibilityError);
|
|
34
32
|
}
|
|
35
33
|
//# sourceMappingURL=fluidErrorBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluidErrorBase.js","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"fluidErrorBase.js","sourceRoot":"","sources":["../src/fluidErrorBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,oBAAoB,GAEpB,MAAM,0CAA0C,CAAC;AAkFlD,MAAM,yBAAyB,GAAG,CAAC,CAAU,EAAW,EAAE,CACzD,OAAQ,CAA8B,EAAE,sBAAsB,KAAK,UAAU;IAC7E,OAAQ,CAA8B,EAAE,sBAAsB,KAAK,UAAU,CAAC;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAU,EAAoC,EAAE,CAClF,OAAQ,CAA0C,EAAE,eAAe,KAAK,QAAQ,CAAC;AAElF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IAC1C,OAAO,CACN,OAAQ,KAAkC,EAAE,SAAS,KAAK,QAAQ;QAClE,OAAQ,KAAkC,EAAE,OAAO,KAAK,QAAQ;QAChE,kBAAkB,CAAC,KAAK,CAAC;QACzB,yBAAyB,CAAC,KAAK,CAAC,CAChC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAC1C,KAAc;IAEd,OAAO,CACN,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,SAAS,KAAK,oBAAoB,CAAC,yBAAyB,CACzF,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tFluidErrorTypesAlpha,\n\ttype ILayerIncompatibilityError,\n} from \"@fluidframework/core-interfaces/internal\";\n\nimport type { ITelemetryPropertiesExt } from \"./telemetryTypes.js\";\n\n/**\n * An error emitted by the Fluid Framework.\n *\n * @remarks\n *\n * All normalized errors flowing through the Fluid Framework adhere to this readonly interface.\n *\n * It features the members of {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | Error}\n * made readonly, as well as {@link IFluidErrorBase.errorType} and {@link IFluidErrorBase.errorInstanceId}.\n * It also features getters and setters for telemetry props to be included when the error is logged.\n *\n * @internal\n */\nexport interface IFluidErrorBase extends Error {\n\t/**\n\t * Classification of what type of error this is.\n\t *\n\t * @remarks Used programmatically by consumers to interpret the error.\n\t */\n\treadonly errorType: string;\n\n\t/**\n\t * Error's message property, made readonly.\n\t *\n\t * @remarks\n\t *\n\t * Recommendations:\n\t *\n\t * Be specific, but also take care when including variable data to consider suitability for aggregation in telemetry.\n\t * Also avoid including any data that jeopardizes the user's privacy. Add a tagged telemetry property instead.\n\t */\n\treadonly message: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack}.\n\t */\n\treadonly stack?: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name}.\n\t */\n\treadonly name: string;\n\n\t/**\n\t * A Guid identifying this error instance.\n\t *\n\t * @remarks\n\t *\n\t * Useful in telemetry for deduplicating multiple logging events arising from the same error,\n\t * or correlating an error with an inner error that caused it, in case of error wrapping.\n\t */\n\treadonly errorInstanceId: string;\n\n\t/**\n\t * When present, inner error that caused this error.\n\t *\n\t * @remarks\n\t * This will often be an {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error|Error}, but could be any type.\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause\n\t *\n\t * @privateRemarks\n\t * The \"cause\" field is added in ES2022. Using it even without that built-in support, is still helpful.\n\t * TODO: remove this declaration (use `Error.cause` property) when targeting ES2022 lib or later.\n\t */\n\tcause?: unknown;\n\n\t/**\n\t * Get the telemetry properties stashed on this error for logging.\n\t */\n\tgetTelemetryProperties(): ITelemetryBaseProperties;\n\n\t/**\n\t * Add telemetry properties to this error which will be logged with the error\n\t */\n\taddTelemetryProperties: (props: ITelemetryPropertiesExt) => void;\n}\n\nconst hasTelemetryPropFunctions = (x: unknown): boolean =>\n\ttypeof (x as Partial<IFluidErrorBase>)?.getTelemetryProperties === \"function\" &&\n\ttypeof (x as Partial<IFluidErrorBase>)?.addTelemetryProperties === \"function\";\n\n/**\n * Type guard for error data containing the {@link IFluidErrorBase.errorInstanceId} property.\n *\n * @internal\n */\nexport const hasErrorInstanceId = (x: unknown): x is { errorInstanceId: string } =>\n\ttypeof (x as Partial<{ errorInstanceId: string }>)?.errorInstanceId === \"string\";\n\n/**\n * Type guard for {@link IFluidErrorBase}.\n *\n * @internal\n */\nexport function isFluidError(error: unknown): error is IFluidErrorBase {\n\treturn (\n\t\ttypeof (error as Partial<IFluidErrorBase>)?.errorType === \"string\" &&\n\t\ttypeof (error as Partial<IFluidErrorBase>)?.message === \"string\" &&\n\t\thasErrorInstanceId(error) &&\n\t\thasTelemetryPropFunctions(error)\n\t);\n}\n\n/**\n * Helper that returns whether the provided error is a layer incompatibility error.\n *\n * @internal\n */\nexport function isLayerIncompatibilityError(\n\terror: unknown,\n): error is ILayerIncompatibilityError {\n\treturn (\n\t\tisFluidError(error) && error.errorType === FluidErrorTypesAlpha.layerIncompatibilityError\n\t);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/telemetry-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.0",
|
|
4
4
|
"description": "Collection of telemetry relates utilities for Fluid",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,22 +69,22 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "~2.
|
|
73
|
-
"@fluidframework/core-interfaces": "~2.
|
|
74
|
-
"@fluidframework/core-utils": "~2.
|
|
75
|
-
"@fluidframework/driver-definitions": "~2.
|
|
72
|
+
"@fluid-internal/client-utils": "~2.72.0",
|
|
73
|
+
"@fluidframework/core-interfaces": "~2.72.0",
|
|
74
|
+
"@fluidframework/core-utils": "~2.72.0",
|
|
75
|
+
"@fluidframework/driver-definitions": "~2.72.0",
|
|
76
76
|
"debug": "^4.3.4",
|
|
77
77
|
"uuid": "^11.1.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
81
81
|
"@biomejs/biome": "~1.9.3",
|
|
82
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
83
|
-
"@fluid-tools/build-cli": "^0.
|
|
82
|
+
"@fluid-internal/mocha-test-setup": "~2.72.0",
|
|
83
|
+
"@fluid-tools/build-cli": "^0.60.0",
|
|
84
84
|
"@fluidframework/build-common": "^2.0.3",
|
|
85
|
-
"@fluidframework/build-tools": "^0.
|
|
86
|
-
"@fluidframework/eslint-config-fluid": "
|
|
87
|
-
"@fluidframework/telemetry-utils-previous": "npm:@fluidframework/telemetry-utils@2.
|
|
85
|
+
"@fluidframework/build-tools": "^0.60.0",
|
|
86
|
+
"@fluidframework/eslint-config-fluid": "~2.72.0",
|
|
87
|
+
"@fluidframework/telemetry-utils-previous": "npm:@fluidframework/telemetry-utils@2.71.0",
|
|
88
88
|
"@microsoft/api-extractor": "7.52.11",
|
|
89
89
|
"@types/debug": "^4.1.5",
|
|
90
90
|
"@types/mocha": "^10.0.10",
|
package/src/error.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type { IErrorBase, ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
7
|
import {
|
|
8
8
|
FluidErrorTypes,
|
|
9
|
-
|
|
9
|
+
FluidErrorTypesAlpha,
|
|
10
10
|
type IGenericError,
|
|
11
11
|
type ILayerIncompatibilityError,
|
|
12
12
|
type IUsageError,
|
|
@@ -222,10 +222,10 @@ export class DataProcessingError extends LoggingError implements IErrorBase, IFl
|
|
|
222
222
|
* @internal
|
|
223
223
|
*/
|
|
224
224
|
export class LayerIncompatibilityError
|
|
225
|
-
extends
|
|
225
|
+
extends LoggingError
|
|
226
226
|
implements ILayerIncompatibilityError
|
|
227
227
|
{
|
|
228
|
-
public
|
|
228
|
+
public readonly errorType = FluidErrorTypesAlpha.layerIncompatibilityError;
|
|
229
229
|
public readonly layer: string;
|
|
230
230
|
public readonly layerVersion: string;
|
|
231
231
|
public readonly incompatibleLayer: string;
|
package/src/fluidErrorBase.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
layerIncompatibilityErrorSymbol,
|
|
8
|
+
FluidErrorTypesAlpha,
|
|
10
9
|
type ILayerIncompatibilityError,
|
|
11
10
|
} from "@fluidframework/core-interfaces/internal";
|
|
12
11
|
|
|
@@ -125,8 +124,6 @@ export function isLayerIncompatibilityError(
|
|
|
125
124
|
error: unknown,
|
|
126
125
|
): error is ILayerIncompatibilityError {
|
|
127
126
|
return (
|
|
128
|
-
isFluidError(error) &&
|
|
129
|
-
error.errorType === FluidErrorTypes.usageError &&
|
|
130
|
-
layerIncompatibilityErrorSymbol in error
|
|
127
|
+
isFluidError(error) && error.errorType === FluidErrorTypesAlpha.layerIncompatibilityError
|
|
131
128
|
);
|
|
132
129
|
}
|