@fluidframework/container-utils
Advanced tools
Comparing version 2.0.0-internal.6.1.1 to 2.0.0-internal.6.2.0
# @fluidframework/container-utils | ||
## 2.0.0-internal.6.2.0 | ||
### Minor Changes | ||
- Remove use of @fluidframework/common-definitions ([#16638](https://github.com/microsoft/FluidFramework/issues/16638)) [a8c81509c9](https://github.com/microsoft/FluidFramework/commits/a8c81509c9bf09cfb2092ebcf7265205f9eb6dbf) | ||
The **@fluidframework/common-definitions** package is being deprecated, so the following interfaces and types are now | ||
imported from the **@fluidframework/core-interfaces** package: | ||
- interface IDisposable | ||
- interface IErrorEvent | ||
- interface IErrorEvent | ||
- interface IEvent | ||
- interface IEventProvider | ||
- interface ILoggingError | ||
- interface ITaggedTelemetryPropertyType | ||
- interface ITelemetryBaseEvent | ||
- interface ITelemetryBaseLogger | ||
- interface ITelemetryErrorEvent | ||
- interface ITelemetryGenericEvent | ||
- interface ITelemetryLogger | ||
- interface ITelemetryPerformanceEvent | ||
- interface ITelemetryProperties | ||
- type ExtendEventProvider | ||
- type IEventThisPlaceHolder | ||
- type IEventTransformer | ||
- type ReplaceIEventThisPlaceHolder | ||
- type ReplaceIEventThisPlaceHolder | ||
- type TelemetryEventCategory | ||
- type TelemetryEventPropertyType | ||
## 2.0.0-internal.6.1.0 | ||
@@ -4,0 +35,0 @@ |
@@ -5,26 +5,15 @@ /*! | ||
*/ | ||
import { ContainerErrorType, IGenericError, IErrorBase, IThrottlingWarning, IUsageError } from "@fluidframework/container-definitions"; | ||
import { LoggingError, IFluidErrorBase, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils"; | ||
import { ITelemetryProperties } from "@fluidframework/common-definitions"; | ||
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions"; | ||
import { IThrottlingWarning } from "@fluidframework/core-interfaces"; | ||
import { IFluidErrorBase, ITelemetryLoggerExt, LoggingError } from "@fluidframework/telemetry-utils"; | ||
/** | ||
* Generic wrapper for an unrecognized/uncategorized error object | ||
*/ | ||
export declare class GenericError extends LoggingError implements IGenericError, IFluidErrorBase { | ||
readonly error?: any; | ||
readonly errorType = ContainerErrorType.genericError; | ||
/** | ||
* Create a new GenericError | ||
* @param message - Error message | ||
* @param error - inner error object | ||
* @param props - Telemetry props to include when the error is logged | ||
*/ | ||
constructor(message: string, error?: any, props?: ITelemetryProperties); | ||
} | ||
/** | ||
* Warning emitted when requests to storage are being throttled. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
export declare class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase { | ||
readonly retryAfterSeconds: number; | ||
readonly errorType = ContainerErrorType.throttlingError; | ||
readonly errorType: "throttlingError"; | ||
private constructor(); | ||
@@ -37,56 +26,15 @@ /** | ||
} | ||
/** Error indicating an API is being used improperly resulting in an invalid operation. */ | ||
export declare class UsageError extends LoggingError implements IUsageError, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.usageError; | ||
constructor(message: string, props?: ITelemetryProperties); | ||
} | ||
/** Error indicating that a client's session has reached its time limit and is closed. */ | ||
/** | ||
* Error indicating that a client's session has reached its time limit and is closed. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
export declare class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase { | ||
readonly expiryMs: number; | ||
readonly errorType = ContainerErrorType.clientSessionExpiredError; | ||
readonly errorType: "clientSessionExpiredError"; | ||
constructor(message: string, expiryMs: number); | ||
} | ||
/** | ||
* DataCorruptionError indicates that we encountered definitive evidence that the data at rest | ||
* backing this container is corrupted, and this container would never be expected to load properly again | ||
*/ | ||
export declare class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.dataCorruptionError; | ||
readonly canRetry = false; | ||
constructor(message: string, props: ITelemetryProperties); | ||
} | ||
/** | ||
* DataProcessingError indicates we hit a fatal error while processing incoming data from the Fluid Service. | ||
* The error will often originate in the dataStore or DDS implementation that is responding to incoming changes. | ||
* This differs from DataCorruptionError in that this may be a transient error that will not repro in another | ||
* client or session. | ||
*/ | ||
export declare class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.dataProcessingError; | ||
readonly canRetry = false; | ||
private constructor(); | ||
/** Create a new DataProcessingError detected and raised with the FF code */ | ||
static create(errorMessage: string, dataProcessingCodepath: string, sequencedMessage?: ISequencedDocumentMessage, props?: ITelemetryProperties): IFluidErrorBase; | ||
/** | ||
* Wrap the given error in a DataProcessingError, unless the error is already of a known type | ||
* with the exception of a normalized LoggingError, which will still be wrapped. | ||
* In either case, the error will have some relevant properties added for telemetry | ||
* We wrap conditionally since known error types represent well-understood failure modes, and ideally | ||
* one day we will move away from throwing these errors but rather we'll return them. | ||
* But an unrecognized error needs to be classified as DataProcessingError. | ||
* @param originalError - error to be converted | ||
* @param dataProcessingCodepath - which codepath failed while processing data | ||
* @param messageLike - Sequenced message to include info about via telemetry props | ||
* @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error | ||
*/ | ||
static wrapIfUnrecognized(originalError: any, dataProcessingCodepath: string, messageLike?: Partial<Pick<ISequencedDocumentMessage, "clientId" | "sequenceNumber" | "clientSequenceNumber" | "referenceSequenceNumber" | "minimumSequenceNumber" | "timestamp">>): IFluidErrorBase; | ||
} | ||
export declare const extractSafePropertiesFromMessage: (messageLike: Partial<Pick<ISequencedDocumentMessage, "clientId" | "sequenceNumber" | "clientSequenceNumber" | "referenceSequenceNumber" | "minimumSequenceNumber" | "timestamp">>) => { | ||
messageClientId: string | undefined; | ||
messageSequenceNumber: number | undefined; | ||
messageClientSequenceNumber: number | undefined; | ||
messageReferenceSequenceNumber: number | undefined; | ||
messageMinimumSequenceNumber: number | undefined; | ||
messageTimestamp: number | undefined; | ||
}; | ||
//# sourceMappingURL=error.d.ts.map |
@@ -7,25 +7,12 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.extractSafePropertiesFromMessage = exports.DataProcessingError = exports.DataCorruptionError = exports.ClientSessionExpiredError = exports.UsageError = exports.ThrottlingWarning = exports.GenericError = void 0; | ||
exports.ClientSessionExpiredError = exports.ThrottlingWarning = void 0; | ||
const container_definitions_1 = require("@fluidframework/container-definitions"); | ||
const telemetry_utils_1 = require("@fluidframework/telemetry-utils"); | ||
/** | ||
* Generic wrapper for an unrecognized/uncategorized error object | ||
*/ | ||
class GenericError extends telemetry_utils_1.LoggingError { | ||
/** | ||
* Create a new GenericError | ||
* @param message - Error message | ||
* @param error - inner error object | ||
* @param props - Telemetry props to include when the error is logged | ||
*/ | ||
constructor(message, error, props) { | ||
// Don't try to log the inner error | ||
super(message, props, new Set(["error"])); | ||
this.error = error; | ||
this.errorType = container_definitions_1.ContainerErrorType.genericError; | ||
} | ||
} | ||
exports.GenericError = GenericError; | ||
/** | ||
* Warning emitted when requests to storage are being throttled. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
@@ -36,3 +23,3 @@ class ThrottlingWarning extends telemetry_utils_1.LoggingError { | ||
this.retryAfterSeconds = retryAfterSeconds; | ||
this.errorType = container_definitions_1.ContainerErrorType.throttlingError; | ||
this.errorType = container_definitions_1.ContainerErrorTypes.throttlingError; | ||
} | ||
@@ -49,11 +36,10 @@ /** | ||
exports.ThrottlingWarning = ThrottlingWarning; | ||
/** Error indicating an API is being used improperly resulting in an invalid operation. */ | ||
class UsageError extends telemetry_utils_1.LoggingError { | ||
constructor(message, props) { | ||
super(message, { ...props, usageError: true }); | ||
this.errorType = container_definitions_1.ContainerErrorType.usageError; | ||
} | ||
} | ||
exports.UsageError = UsageError; | ||
/** Error indicating that a client's session has reached its time limit and is closed. */ | ||
/** | ||
* Error indicating that a client's session has reached its time limit and is closed. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
class ClientSessionExpiredError extends telemetry_utils_1.LoggingError { | ||
@@ -63,80 +49,6 @@ constructor(message, expiryMs) { | ||
this.expiryMs = expiryMs; | ||
this.errorType = container_definitions_1.ContainerErrorType.clientSessionExpiredError; | ||
this.errorType = container_definitions_1.ContainerErrorTypes.clientSessionExpiredError; | ||
} | ||
} | ||
exports.ClientSessionExpiredError = ClientSessionExpiredError; | ||
/** | ||
* DataCorruptionError indicates that we encountered definitive evidence that the data at rest | ||
* backing this container is corrupted, and this container would never be expected to load properly again | ||
*/ | ||
class DataCorruptionError extends telemetry_utils_1.LoggingError { | ||
constructor(message, props) { | ||
super(message, { ...props, dataProcessingError: 1 }); | ||
this.errorType = container_definitions_1.ContainerErrorType.dataCorruptionError; | ||
this.canRetry = false; | ||
} | ||
} | ||
exports.DataCorruptionError = DataCorruptionError; | ||
/** | ||
* DataProcessingError indicates we hit a fatal error while processing incoming data from the Fluid Service. | ||
* The error will often originate in the dataStore or DDS implementation that is responding to incoming changes. | ||
* This differs from DataCorruptionError in that this may be a transient error that will not repro in another | ||
* client or session. | ||
*/ | ||
class DataProcessingError extends telemetry_utils_1.LoggingError { | ||
constructor(errorMessage) { | ||
super(errorMessage); | ||
this.errorType = container_definitions_1.ContainerErrorType.dataProcessingError; | ||
this.canRetry = false; | ||
} | ||
/** Create a new DataProcessingError detected and raised with the FF code */ | ||
static create(errorMessage, dataProcessingCodepath, sequencedMessage, props = {}) { | ||
const dataProcessingError = DataProcessingError.wrapIfUnrecognized(errorMessage, dataProcessingCodepath, sequencedMessage); | ||
dataProcessingError.addTelemetryProperties(props); | ||
return dataProcessingError; | ||
} | ||
/** | ||
* Wrap the given error in a DataProcessingError, unless the error is already of a known type | ||
* with the exception of a normalized LoggingError, which will still be wrapped. | ||
* In either case, the error will have some relevant properties added for telemetry | ||
* We wrap conditionally since known error types represent well-understood failure modes, and ideally | ||
* one day we will move away from throwing these errors but rather we'll return them. | ||
* But an unrecognized error needs to be classified as DataProcessingError. | ||
* @param originalError - error to be converted | ||
* @param dataProcessingCodepath - which codepath failed while processing data | ||
* @param messageLike - Sequenced message to include info about via telemetry props | ||
* @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error | ||
*/ | ||
static wrapIfUnrecognized(originalError, dataProcessingCodepath, messageLike) { | ||
const props = { | ||
dataProcessingError: 1, | ||
dataProcessingCodepath, | ||
...(messageLike === undefined | ||
? undefined | ||
: (0, exports.extractSafePropertiesFromMessage)(messageLike)), | ||
}; | ||
const normalizedError = (0, telemetry_utils_1.normalizeError)(originalError, { props }); | ||
// Note that other errors may have the NORMALIZED_ERROR_TYPE errorType, | ||
// but if so they are still suitable to be wrapped as DataProcessingError. | ||
if ((0, telemetry_utils_1.isExternalError)(normalizedError) || | ||
normalizedError.errorType === telemetry_utils_1.NORMALIZED_ERROR_TYPE) { | ||
// Create a new DataProcessingError to wrap this external error | ||
const dataProcessingError = (0, telemetry_utils_1.wrapError)(normalizedError, (message) => new DataProcessingError(message)); | ||
// Copy over the props above and any others added to this error since first being normalized | ||
dataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties()); | ||
return dataProcessingError; | ||
} | ||
return normalizedError; | ||
} | ||
} | ||
exports.DataProcessingError = DataProcessingError; | ||
const extractSafePropertiesFromMessage = (messageLike) => ({ | ||
messageClientId: messageLike.clientId === null ? "null" : messageLike.clientId, | ||
messageSequenceNumber: messageLike.sequenceNumber, | ||
messageClientSequenceNumber: messageLike.clientSequenceNumber, | ||
messageReferenceSequenceNumber: messageLike.referenceSequenceNumber, | ||
messageMinimumSequenceNumber: messageLike.minimumSequenceNumber, | ||
messageTimestamp: messageLike.timestamp, | ||
}); | ||
exports.extractSafePropertiesFromMessage = extractSafePropertiesFromMessage; | ||
//# sourceMappingURL=error.js.map |
@@ -5,4 +5,34 @@ /*! | ||
*/ | ||
/** | ||
* @deprecated | ||
* | ||
* Note: this package is scheduled for deletion. | ||
* Remaining exports are here for backwards compatibility and to notify consumers where to look for replacement APIs. | ||
* Please do not add any new code or exports to this package. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
export { DeltaManagerProxyBase } from "./deltaManagerProxyBase"; | ||
export { ClientSessionExpiredError, DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, GenericError, ThrottlingWarning, UsageError, } from "./error"; | ||
export { ClientSessionExpiredError, ThrottlingWarning } from "./error"; | ||
export { | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
DataCorruptionError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
DataProcessingError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
extractSafePropertiesFromMessage, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
GenericError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
UsageError, } from "@fluidframework/telemetry-utils"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,3 +7,12 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UsageError = exports.ThrottlingWarning = exports.GenericError = exports.extractSafePropertiesFromMessage = exports.DataProcessingError = exports.DataCorruptionError = exports.ClientSessionExpiredError = exports.DeltaManagerProxyBase = void 0; | ||
exports.UsageError = exports.GenericError = exports.extractSafePropertiesFromMessage = exports.DataProcessingError = exports.DataCorruptionError = exports.ThrottlingWarning = exports.ClientSessionExpiredError = exports.DeltaManagerProxyBase = void 0; | ||
/** | ||
* @deprecated | ||
* | ||
* Note: this package is scheduled for deletion. | ||
* Remaining exports are here for backwards compatibility and to notify consumers where to look for replacement APIs. | ||
* Please do not add any new code or exports to this package. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
var deltaManagerProxyBase_1 = require("./deltaManagerProxyBase"); | ||
@@ -13,8 +22,25 @@ Object.defineProperty(exports, "DeltaManagerProxyBase", { enumerable: true, get: function () { return deltaManagerProxyBase_1.DeltaManagerProxyBase; } }); | ||
Object.defineProperty(exports, "ClientSessionExpiredError", { enumerable: true, get: function () { return error_1.ClientSessionExpiredError; } }); | ||
Object.defineProperty(exports, "DataCorruptionError", { enumerable: true, get: function () { return error_1.DataCorruptionError; } }); | ||
Object.defineProperty(exports, "DataProcessingError", { enumerable: true, get: function () { return error_1.DataProcessingError; } }); | ||
Object.defineProperty(exports, "extractSafePropertiesFromMessage", { enumerable: true, get: function () { return error_1.extractSafePropertiesFromMessage; } }); | ||
Object.defineProperty(exports, "GenericError", { enumerable: true, get: function () { return error_1.GenericError; } }); | ||
Object.defineProperty(exports, "ThrottlingWarning", { enumerable: true, get: function () { return error_1.ThrottlingWarning; } }); | ||
Object.defineProperty(exports, "UsageError", { enumerable: true, get: function () { return error_1.UsageError; } }); | ||
// Deprecated exports for backwards compatibility | ||
var telemetry_utils_1 = require("@fluidframework/telemetry-utils"); | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
Object.defineProperty(exports, "DataCorruptionError", { enumerable: true, get: function () { return telemetry_utils_1.DataCorruptionError; } }); | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
Object.defineProperty(exports, "DataProcessingError", { enumerable: true, get: function () { return telemetry_utils_1.DataProcessingError; } }); | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
Object.defineProperty(exports, "extractSafePropertiesFromMessage", { enumerable: true, get: function () { return telemetry_utils_1.extractSafePropertiesFromMessage; } }); | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
Object.defineProperty(exports, "GenericError", { enumerable: true, get: function () { return telemetry_utils_1.GenericError; } }); | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
Object.defineProperty(exports, "UsageError", { enumerable: true, get: function () { return telemetry_utils_1.UsageError; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -5,26 +5,15 @@ /*! | ||
*/ | ||
import { ContainerErrorType, IGenericError, IErrorBase, IThrottlingWarning, IUsageError } from "@fluidframework/container-definitions"; | ||
import { LoggingError, IFluidErrorBase, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils"; | ||
import { ITelemetryProperties } from "@fluidframework/common-definitions"; | ||
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions"; | ||
import { IThrottlingWarning } from "@fluidframework/core-interfaces"; | ||
import { IFluidErrorBase, ITelemetryLoggerExt, LoggingError } from "@fluidframework/telemetry-utils"; | ||
/** | ||
* Generic wrapper for an unrecognized/uncategorized error object | ||
*/ | ||
export declare class GenericError extends LoggingError implements IGenericError, IFluidErrorBase { | ||
readonly error?: any; | ||
readonly errorType = ContainerErrorType.genericError; | ||
/** | ||
* Create a new GenericError | ||
* @param message - Error message | ||
* @param error - inner error object | ||
* @param props - Telemetry props to include when the error is logged | ||
*/ | ||
constructor(message: string, error?: any, props?: ITelemetryProperties); | ||
} | ||
/** | ||
* Warning emitted when requests to storage are being throttled. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
export declare class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase { | ||
readonly retryAfterSeconds: number; | ||
readonly errorType = ContainerErrorType.throttlingError; | ||
readonly errorType: "throttlingError"; | ||
private constructor(); | ||
@@ -37,56 +26,15 @@ /** | ||
} | ||
/** Error indicating an API is being used improperly resulting in an invalid operation. */ | ||
export declare class UsageError extends LoggingError implements IUsageError, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.usageError; | ||
constructor(message: string, props?: ITelemetryProperties); | ||
} | ||
/** Error indicating that a client's session has reached its time limit and is closed. */ | ||
/** | ||
* Error indicating that a client's session has reached its time limit and is closed. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
export declare class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase { | ||
readonly expiryMs: number; | ||
readonly errorType = ContainerErrorType.clientSessionExpiredError; | ||
readonly errorType: "clientSessionExpiredError"; | ||
constructor(message: string, expiryMs: number); | ||
} | ||
/** | ||
* DataCorruptionError indicates that we encountered definitive evidence that the data at rest | ||
* backing this container is corrupted, and this container would never be expected to load properly again | ||
*/ | ||
export declare class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.dataCorruptionError; | ||
readonly canRetry = false; | ||
constructor(message: string, props: ITelemetryProperties); | ||
} | ||
/** | ||
* DataProcessingError indicates we hit a fatal error while processing incoming data from the Fluid Service. | ||
* The error will often originate in the dataStore or DDS implementation that is responding to incoming changes. | ||
* This differs from DataCorruptionError in that this may be a transient error that will not repro in another | ||
* client or session. | ||
*/ | ||
export declare class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.dataProcessingError; | ||
readonly canRetry = false; | ||
private constructor(); | ||
/** Create a new DataProcessingError detected and raised with the FF code */ | ||
static create(errorMessage: string, dataProcessingCodepath: string, sequencedMessage?: ISequencedDocumentMessage, props?: ITelemetryProperties): IFluidErrorBase; | ||
/** | ||
* Wrap the given error in a DataProcessingError, unless the error is already of a known type | ||
* with the exception of a normalized LoggingError, which will still be wrapped. | ||
* In either case, the error will have some relevant properties added for telemetry | ||
* We wrap conditionally since known error types represent well-understood failure modes, and ideally | ||
* one day we will move away from throwing these errors but rather we'll return them. | ||
* But an unrecognized error needs to be classified as DataProcessingError. | ||
* @param originalError - error to be converted | ||
* @param dataProcessingCodepath - which codepath failed while processing data | ||
* @param messageLike - Sequenced message to include info about via telemetry props | ||
* @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error | ||
*/ | ||
static wrapIfUnrecognized(originalError: any, dataProcessingCodepath: string, messageLike?: Partial<Pick<ISequencedDocumentMessage, "clientId" | "sequenceNumber" | "clientSequenceNumber" | "referenceSequenceNumber" | "minimumSequenceNumber" | "timestamp">>): IFluidErrorBase; | ||
} | ||
export declare const extractSafePropertiesFromMessage: (messageLike: Partial<Pick<ISequencedDocumentMessage, "clientId" | "sequenceNumber" | "clientSequenceNumber" | "referenceSequenceNumber" | "minimumSequenceNumber" | "timestamp">>) => { | ||
messageClientId: string | undefined; | ||
messageSequenceNumber: number | undefined; | ||
messageClientSequenceNumber: number | undefined; | ||
messageReferenceSequenceNumber: number | undefined; | ||
messageMinimumSequenceNumber: number | undefined; | ||
messageTimestamp: number | undefined; | ||
}; | ||
//# sourceMappingURL=error.d.ts.map |
117
lib/error.js
@@ -5,23 +5,11 @@ /*! | ||
*/ | ||
import { ContainerErrorType, } from "@fluidframework/container-definitions"; | ||
import { LoggingError, normalizeError, wrapError, wrapErrorAndLog, isExternalError, NORMALIZED_ERROR_TYPE, } from "@fluidframework/telemetry-utils"; | ||
import { ContainerErrorTypes } from "@fluidframework/container-definitions"; | ||
import { LoggingError, wrapErrorAndLog, } from "@fluidframework/telemetry-utils"; | ||
/** | ||
* Generic wrapper for an unrecognized/uncategorized error object | ||
*/ | ||
export class GenericError extends LoggingError { | ||
/** | ||
* Create a new GenericError | ||
* @param message - Error message | ||
* @param error - inner error object | ||
* @param props - Telemetry props to include when the error is logged | ||
*/ | ||
constructor(message, error, props) { | ||
// Don't try to log the inner error | ||
super(message, props, new Set(["error"])); | ||
this.error = error; | ||
this.errorType = ContainerErrorType.genericError; | ||
} | ||
} | ||
/** | ||
* Warning emitted when requests to storage are being throttled. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
@@ -32,3 +20,3 @@ export class ThrottlingWarning extends LoggingError { | ||
this.retryAfterSeconds = retryAfterSeconds; | ||
this.errorType = ContainerErrorType.throttlingError; | ||
this.errorType = ContainerErrorTypes.throttlingError; | ||
} | ||
@@ -44,10 +32,10 @@ /** | ||
} | ||
/** Error indicating an API is being used improperly resulting in an invalid operation. */ | ||
export class UsageError extends LoggingError { | ||
constructor(message, props) { | ||
super(message, { ...props, usageError: true }); | ||
this.errorType = ContainerErrorType.usageError; | ||
} | ||
} | ||
/** Error indicating that a client's session has reached its time limit and is closed. */ | ||
/** | ||
* Error indicating that a client's session has reached its time limit and is closed. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
export class ClientSessionExpiredError extends LoggingError { | ||
@@ -57,76 +45,5 @@ constructor(message, expiryMs) { | ||
this.expiryMs = expiryMs; | ||
this.errorType = ContainerErrorType.clientSessionExpiredError; | ||
this.errorType = ContainerErrorTypes.clientSessionExpiredError; | ||
} | ||
} | ||
/** | ||
* DataCorruptionError indicates that we encountered definitive evidence that the data at rest | ||
* backing this container is corrupted, and this container would never be expected to load properly again | ||
*/ | ||
export class DataCorruptionError extends LoggingError { | ||
constructor(message, props) { | ||
super(message, { ...props, dataProcessingError: 1 }); | ||
this.errorType = ContainerErrorType.dataCorruptionError; | ||
this.canRetry = false; | ||
} | ||
} | ||
/** | ||
* DataProcessingError indicates we hit a fatal error while processing incoming data from the Fluid Service. | ||
* The error will often originate in the dataStore or DDS implementation that is responding to incoming changes. | ||
* This differs from DataCorruptionError in that this may be a transient error that will not repro in another | ||
* client or session. | ||
*/ | ||
export class DataProcessingError extends LoggingError { | ||
constructor(errorMessage) { | ||
super(errorMessage); | ||
this.errorType = ContainerErrorType.dataProcessingError; | ||
this.canRetry = false; | ||
} | ||
/** Create a new DataProcessingError detected and raised with the FF code */ | ||
static create(errorMessage, dataProcessingCodepath, sequencedMessage, props = {}) { | ||
const dataProcessingError = DataProcessingError.wrapIfUnrecognized(errorMessage, dataProcessingCodepath, sequencedMessage); | ||
dataProcessingError.addTelemetryProperties(props); | ||
return dataProcessingError; | ||
} | ||
/** | ||
* Wrap the given error in a DataProcessingError, unless the error is already of a known type | ||
* with the exception of a normalized LoggingError, which will still be wrapped. | ||
* In either case, the error will have some relevant properties added for telemetry | ||
* We wrap conditionally since known error types represent well-understood failure modes, and ideally | ||
* one day we will move away from throwing these errors but rather we'll return them. | ||
* But an unrecognized error needs to be classified as DataProcessingError. | ||
* @param originalError - error to be converted | ||
* @param dataProcessingCodepath - which codepath failed while processing data | ||
* @param messageLike - Sequenced message to include info about via telemetry props | ||
* @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error | ||
*/ | ||
static wrapIfUnrecognized(originalError, dataProcessingCodepath, messageLike) { | ||
const props = { | ||
dataProcessingError: 1, | ||
dataProcessingCodepath, | ||
...(messageLike === undefined | ||
? undefined | ||
: extractSafePropertiesFromMessage(messageLike)), | ||
}; | ||
const normalizedError = normalizeError(originalError, { props }); | ||
// Note that other errors may have the NORMALIZED_ERROR_TYPE errorType, | ||
// but if so they are still suitable to be wrapped as DataProcessingError. | ||
if (isExternalError(normalizedError) || | ||
normalizedError.errorType === NORMALIZED_ERROR_TYPE) { | ||
// Create a new DataProcessingError to wrap this external error | ||
const dataProcessingError = wrapError(normalizedError, (message) => new DataProcessingError(message)); | ||
// Copy over the props above and any others added to this error since first being normalized | ||
dataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties()); | ||
return dataProcessingError; | ||
} | ||
return normalizedError; | ||
} | ||
} | ||
export const extractSafePropertiesFromMessage = (messageLike) => ({ | ||
messageClientId: messageLike.clientId === null ? "null" : messageLike.clientId, | ||
messageSequenceNumber: messageLike.sequenceNumber, | ||
messageClientSequenceNumber: messageLike.clientSequenceNumber, | ||
messageReferenceSequenceNumber: messageLike.referenceSequenceNumber, | ||
messageMinimumSequenceNumber: messageLike.minimumSequenceNumber, | ||
messageTimestamp: messageLike.timestamp, | ||
}); | ||
//# sourceMappingURL=error.js.map |
@@ -5,4 +5,34 @@ /*! | ||
*/ | ||
/** | ||
* @deprecated | ||
* | ||
* Note: this package is scheduled for deletion. | ||
* Remaining exports are here for backwards compatibility and to notify consumers where to look for replacement APIs. | ||
* Please do not add any new code or exports to this package. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
export { DeltaManagerProxyBase } from "./deltaManagerProxyBase"; | ||
export { ClientSessionExpiredError, DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, GenericError, ThrottlingWarning, UsageError, } from "./error"; | ||
export { ClientSessionExpiredError, ThrottlingWarning } from "./error"; | ||
export { | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
DataCorruptionError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
DataProcessingError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
extractSafePropertiesFromMessage, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
GenericError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
UsageError, } from "@fluidframework/telemetry-utils"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,4 +5,35 @@ /*! | ||
*/ | ||
/** | ||
* @deprecated | ||
* | ||
* Note: this package is scheduled for deletion. | ||
* Remaining exports are here for backwards compatibility and to notify consumers where to look for replacement APIs. | ||
* Please do not add any new code or exports to this package. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
export { DeltaManagerProxyBase } from "./deltaManagerProxyBase"; | ||
export { ClientSessionExpiredError, DataCorruptionError, DataProcessingError, extractSafePropertiesFromMessage, GenericError, ThrottlingWarning, UsageError, } from "./error"; | ||
export { ClientSessionExpiredError, ThrottlingWarning } from "./error"; | ||
// Deprecated exports for backwards compatibility | ||
export { | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
DataCorruptionError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
DataProcessingError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
extractSafePropertiesFromMessage, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
GenericError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
UsageError, } from "@fluidframework/telemetry-utils"; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@fluidframework/container-utils", | ||
"version": "2.0.0-internal.6.1.1", | ||
"version": "2.0.0-internal.6.2.0", | ||
"description": "Fluid container utils", | ||
@@ -17,49 +17,20 @@ "homepage": "https://fluidframework.com", | ||
"types": "dist/index.d.ts", | ||
"nyc": { | ||
"all": true, | ||
"cache-dir": "nyc/.cache", | ||
"exclude": [ | ||
"src/test/**/*.ts", | ||
"dist/test/**/*.js" | ||
], | ||
"exclude-after-remap": false, | ||
"include": [ | ||
"src/**/*.ts", | ||
"dist/**/*.js" | ||
], | ||
"report-dir": "nyc/report", | ||
"reporter": [ | ||
"cobertura", | ||
"html", | ||
"text" | ||
], | ||
"temp-directory": "nyc/.nyc_output" | ||
}, | ||
"dependencies": { | ||
"@fluidframework/common-definitions": "^0.20.1", | ||
"@fluidframework/common-utils": "^1.1.1", | ||
"@fluidframework/container-definitions": ">=2.0.0-internal.6.1.1 <2.0.0-internal.6.2.0", | ||
"@fluidframework/container-definitions": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0", | ||
"@fluidframework/core-interfaces": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0", | ||
"@fluidframework/protocol-definitions": "^1.1.0", | ||
"@fluidframework/telemetry-utils": ">=2.0.0-internal.6.1.1 <2.0.0-internal.6.2.0" | ||
"@fluidframework/telemetry-utils": ">=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0" | ||
}, | ||
"devDependencies": { | ||
"@fluid-tools/build-cli": "^0.22.0", | ||
"@fluid-tools/build-cli": "^0.23.0", | ||
"@fluidframework/build-common": "^2.0.0", | ||
"@fluidframework/build-tools": "^0.22.0", | ||
"@fluidframework/container-utils-previous": "npm:@fluidframework/container-utils@2.0.0-internal.6.0.0", | ||
"@fluidframework/eslint-config-fluid": "^2.0.0", | ||
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.6.1.1 <2.0.0-internal.6.2.0", | ||
"@fluidframework/test-runtime-utils": ">=2.0.0-internal.6.1.1 <2.0.0-internal.6.2.0", | ||
"@fluidframework/build-tools": "^0.23.0", | ||
"@fluidframework/container-utils-previous": "npm:@fluidframework/container-utils@2.0.0-internal.6.1.1", | ||
"@fluidframework/eslint-config-fluid": "^2.1.0", | ||
"@microsoft/api-extractor": "^7.34.4", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^16.18.38", | ||
"concurrently": "^7.6.0", | ||
"copyfiles": "^2.4.1", | ||
"cross-env": "^7.0.3", | ||
"eslint": "~8.6.0", | ||
"mocha": "^10.2.0", | ||
"mocha-json-output-reporter": "^2.0.1", | ||
"mocha-multi-reporters": "^1.5.1", | ||
"moment": "^2.21.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "~2.6.2", | ||
@@ -70,3 +41,22 @@ "rimraf": "^4.4.0", | ||
"typeValidation": { | ||
"broken": {} | ||
"broken": { | ||
"ClassDeclaration_ClientSessionExpiredError": { | ||
"backCompat": false | ||
}, | ||
"ClassDeclaration_DataCorruptionError": { | ||
"backCompat": false | ||
}, | ||
"ClassDeclaration_DataProcessingError": { | ||
"backCompat": false | ||
}, | ||
"ClassDeclaration_GenericError": { | ||
"backCompat": false | ||
}, | ||
"ClassDeclaration_ThrottlingWarning": { | ||
"backCompat": false | ||
}, | ||
"ClassDeclaration_UsageError": { | ||
"backCompat": false | ||
} | ||
} | ||
}, | ||
@@ -89,7 +79,3 @@ "scripts": { | ||
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore", | ||
"test": "npm run test:mocha", | ||
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml", | ||
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict", | ||
"test:mocha:multireport": "cross-env FLUID_TEST_MULTIREPORT=1 npm run test:mocha", | ||
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha", | ||
"test": "echo \"This package is scheduled for deletion and now contains no tests.\" && exit 1", | ||
"tsc": "tsc", | ||
@@ -96,0 +82,0 @@ "tsc:watch": "tsc --watch", |
# @fluidframework/container-utils | ||
Contains various helper utilities available to both runtime & container layers | ||
**DEPRECATED: THE CONTENTS OF THIS PACKAGE HAVE BEEN MOVED TO OTHER LIBRARIES WITHIN THE FLUID FRAMEWORK.** | ||
<!-- AUTO-GENERATED-CONTENT:START (LIBRARY_PACKAGE_README:scripts=FALSE) --> | ||
**ALL REMAINING API MEMBERS HAVE BEEN DOCUMENTED WITH MIGRATION INSTRUCTIONS.** | ||
<!-- prettier-ignore-start --> | ||
<!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. --> | ||
## Using Fluid Framework libraries | ||
When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`. | ||
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries, | ||
library consumers should always prefer `^`. | ||
Note that when depending on a library version of the form 2.0.0-internal.x.y.z, called the Fluid internal version | ||
scheme, you must use a `>= <` dependency range. Standard `^` and `~` ranges will not work as expected. See the | ||
[@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md) | ||
package for more information including tools to convert between version schemes. | ||
## Installation | ||
To get started, install the package by running the following command: | ||
```bash | ||
npm i @fluidframework/container-utils | ||
``` | ||
## API Documentation | ||
API documentation for **@fluidframework/container-utils** is available at <https://fluidframework.com/docs/apis/container-utils>. | ||
## Contribution Guidelines | ||
There are many ways to [contribute](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md) to Fluid. | ||
- Participate in Q&A in our [GitHub Discussions](https://github.com/microsoft/FluidFramework/discussions). | ||
- [Submit bugs](https://github.com/microsoft/FluidFramework/issues) and help us verify fixes as they are checked in. | ||
- Review the [source code changes](https://github.com/microsoft/FluidFramework/pulls). | ||
- [Contribute bug fixes](https://github.com/microsoft/FluidFramework/blob/main/CONTRIBUTING.md). | ||
Detailed instructions for working in the repo can be found in the [Wiki](https://github.com/microsoft/FluidFramework/wiki). | ||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. | ||
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services. | ||
Use of these trademarks or logos must follow Microsoft’s [Trademark & Brand Guidelines](https://www.microsoft.com/trademarks). | ||
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. | ||
## Help | ||
Not finding what you're looking for in this README? Check out our [GitHub | ||
Wiki](https://github.com/microsoft/FluidFramework/wiki) or [fluidframework.com](https://fluidframework.com/docs/). | ||
Still not finding what you're looking for? Please [file an | ||
issue](https://github.com/microsoft/FluidFramework/wiki/Submitting-Bugs-and-Feature-Requests). | ||
Thank you! | ||
## Trademark | ||
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services. | ||
Use of these trademarks or logos must follow Microsoft's [Trademark & Brand | ||
Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). | ||
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. | ||
<!-- prettier-ignore-end --> | ||
<!-- AUTO-GENERATED-CONTENT:END --> | ||
**THIS PACKAGE WILL RECEIVE NO FURTHER SUPPORT.** |
186
src/error.ts
@@ -6,45 +6,21 @@ /*! | ||
import { ITelemetryProperties, IThrottlingWarning } from "@fluidframework/core-interfaces"; | ||
import { ContainerErrorTypes } from "@fluidframework/container-definitions"; | ||
import { | ||
ContainerErrorType, | ||
IGenericError, | ||
IErrorBase, | ||
IThrottlingWarning, | ||
IUsageError, | ||
} from "@fluidframework/container-definitions"; | ||
import { | ||
IFluidErrorBase, | ||
ITelemetryLoggerExt, | ||
LoggingError, | ||
IFluidErrorBase, | ||
normalizeError, | ||
wrapError, | ||
wrapErrorAndLog, | ||
isExternalError, | ||
NORMALIZED_ERROR_TYPE, | ||
ITelemetryLoggerExt, | ||
} from "@fluidframework/telemetry-utils"; | ||
import { ITelemetryProperties } from "@fluidframework/common-definitions"; | ||
import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions"; | ||
/** | ||
* Generic wrapper for an unrecognized/uncategorized error object | ||
*/ | ||
export class GenericError extends LoggingError implements IGenericError, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.genericError; | ||
/** | ||
* Create a new GenericError | ||
* @param message - Error message | ||
* @param error - inner error object | ||
* @param props - Telemetry props to include when the error is logged | ||
*/ | ||
constructor(message: string, readonly error?: any, props?: ITelemetryProperties) { | ||
// Don't try to log the inner error | ||
super(message, props, new Set(["error"])); | ||
} | ||
} | ||
/** | ||
* Warning emitted when requests to storage are being throttled. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
export class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.throttlingError; | ||
readonly errorType = ContainerErrorTypes.throttlingError; | ||
@@ -73,14 +49,12 @@ private constructor( | ||
/** Error indicating an API is being used improperly resulting in an invalid operation. */ | ||
export class UsageError extends LoggingError implements IUsageError, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.usageError; | ||
constructor(message: string, props?: ITelemetryProperties) { | ||
super(message, { ...props, usageError: true }); | ||
} | ||
} | ||
/** Error indicating that a client's session has reached its time limit and is closed. */ | ||
/** | ||
* Error indicating that a client's session has reached its time limit and is closed. | ||
* | ||
* @deprecated | ||
* | ||
* This type is not intended for external use and is being removed from library exports. | ||
* No replacement API is intended. | ||
*/ | ||
export class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.clientSessionExpiredError; | ||
readonly errorType = ContainerErrorTypes.clientSessionExpiredError; | ||
@@ -91,123 +65,1 @@ constructor(message: string, readonly expiryMs: number) { | ||
} | ||
/** | ||
* DataCorruptionError indicates that we encountered definitive evidence that the data at rest | ||
* backing this container is corrupted, and this container would never be expected to load properly again | ||
*/ | ||
export class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.dataCorruptionError; | ||
readonly canRetry = false; | ||
constructor(message: string, props: ITelemetryProperties) { | ||
super(message, { ...props, dataProcessingError: 1 }); | ||
} | ||
} | ||
/** | ||
* DataProcessingError indicates we hit a fatal error while processing incoming data from the Fluid Service. | ||
* The error will often originate in the dataStore or DDS implementation that is responding to incoming changes. | ||
* This differs from DataCorruptionError in that this may be a transient error that will not repro in another | ||
* client or session. | ||
*/ | ||
export class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase { | ||
readonly errorType = ContainerErrorType.dataProcessingError; | ||
readonly canRetry = false; | ||
private constructor(errorMessage: string) { | ||
super(errorMessage); | ||
} | ||
/** Create a new DataProcessingError detected and raised with the FF code */ | ||
static create( | ||
errorMessage: string, | ||
dataProcessingCodepath: string, | ||
sequencedMessage?: ISequencedDocumentMessage, | ||
props: ITelemetryProperties = {}, | ||
) { | ||
const dataProcessingError = DataProcessingError.wrapIfUnrecognized( | ||
errorMessage, | ||
dataProcessingCodepath, | ||
sequencedMessage, | ||
); | ||
dataProcessingError.addTelemetryProperties(props); | ||
return dataProcessingError; | ||
} | ||
/** | ||
* Wrap the given error in a DataProcessingError, unless the error is already of a known type | ||
* with the exception of a normalized LoggingError, which will still be wrapped. | ||
* In either case, the error will have some relevant properties added for telemetry | ||
* We wrap conditionally since known error types represent well-understood failure modes, and ideally | ||
* one day we will move away from throwing these errors but rather we'll return them. | ||
* But an unrecognized error needs to be classified as DataProcessingError. | ||
* @param originalError - error to be converted | ||
* @param dataProcessingCodepath - which codepath failed while processing data | ||
* @param messageLike - Sequenced message to include info about via telemetry props | ||
* @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error | ||
*/ | ||
static wrapIfUnrecognized( | ||
originalError: any, | ||
dataProcessingCodepath: string, | ||
messageLike?: Partial< | ||
Pick< | ||
ISequencedDocumentMessage, | ||
| "clientId" | ||
| "sequenceNumber" | ||
| "clientSequenceNumber" | ||
| "referenceSequenceNumber" | ||
| "minimumSequenceNumber" | ||
| "timestamp" | ||
> | ||
>, | ||
): IFluidErrorBase { | ||
const props = { | ||
dataProcessingError: 1, | ||
dataProcessingCodepath, | ||
...(messageLike === undefined | ||
? undefined | ||
: extractSafePropertiesFromMessage(messageLike)), | ||
}; | ||
const normalizedError = normalizeError(originalError, { props }); | ||
// Note that other errors may have the NORMALIZED_ERROR_TYPE errorType, | ||
// but if so they are still suitable to be wrapped as DataProcessingError. | ||
if ( | ||
isExternalError(normalizedError) || | ||
normalizedError.errorType === NORMALIZED_ERROR_TYPE | ||
) { | ||
// Create a new DataProcessingError to wrap this external error | ||
const dataProcessingError = wrapError( | ||
normalizedError, | ||
(message: string) => new DataProcessingError(message), | ||
); | ||
// Copy over the props above and any others added to this error since first being normalized | ||
dataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties()); | ||
return dataProcessingError; | ||
} | ||
return normalizedError; | ||
} | ||
} | ||
export const extractSafePropertiesFromMessage = ( | ||
messageLike: Partial< | ||
Pick< | ||
ISequencedDocumentMessage, | ||
| "clientId" | ||
| "sequenceNumber" | ||
| "clientSequenceNumber" | ||
| "referenceSequenceNumber" | ||
| "minimumSequenceNumber" | ||
| "timestamp" | ||
> | ||
>, | ||
) => ({ | ||
messageClientId: messageLike.clientId === null ? "null" : messageLike.clientId, | ||
messageSequenceNumber: messageLike.sequenceNumber, | ||
messageClientSequenceNumber: messageLike.clientSequenceNumber, | ||
messageReferenceSequenceNumber: messageLike.referenceSequenceNumber, | ||
messageMinimumSequenceNumber: messageLike.minimumSequenceNumber, | ||
messageTimestamp: messageLike.timestamp, | ||
}); |
@@ -6,11 +6,37 @@ /*! | ||
/** | ||
* @deprecated | ||
* | ||
* Note: this package is scheduled for deletion. | ||
* Remaining exports are here for backwards compatibility and to notify consumers where to look for replacement APIs. | ||
* Please do not add any new code or exports to this package. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
export { DeltaManagerProxyBase } from "./deltaManagerProxyBase"; | ||
export { ClientSessionExpiredError, ThrottlingWarning } from "./error"; | ||
// Deprecated exports for backwards compatibility | ||
export { | ||
ClientSessionExpiredError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
DataCorruptionError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
DataProcessingError, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
extractSafePropertiesFromMessage, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
GenericError, | ||
ThrottlingWarning, | ||
/** | ||
* @deprecated Import from `@fluidframework/telemetry-utils` instead. | ||
*/ | ||
UsageError, | ||
} from "./error"; | ||
} from "@fluidframework/telemetry-utils"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13
59177
37
797
2
8
+ Added@fluidframework/core-interfaces@>=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0
+ Added@fluidframework/container-definitions@2.0.0-internal.6.2.2(transitive)
+ Added@fluidframework/core-interfaces@2.0.0-internal.6.2.2(transitive)
+ Added@fluidframework/core-utils@2.0.0-internal.6.2.2(transitive)
+ Added@fluidframework/driver-definitions@2.0.0-internal.6.2.2(transitive)
+ Added@fluidframework/telemetry-utils@2.0.0-internal.6.2.2(transitive)
+ Addeduuid@9.0.1(transitive)
- Removed@fluidframework/container-definitions@2.0.0-internal.6.1.3(transitive)
- Removed@fluidframework/core-interfaces@2.0.0-internal.6.1.3(transitive)
- Removed@fluidframework/core-utils@2.0.0-internal.6.1.3(transitive)
- Removed@fluidframework/driver-definitions@2.0.0-internal.6.1.3(transitive)
- Removed@fluidframework/telemetry-utils@2.0.0-internal.6.1.3(transitive)
- Removeduuid@8.3.2(transitive)
Updated@fluidframework/container-definitions@>=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0
Updated@fluidframework/telemetry-utils@>=2.0.0-internal.6.2.0 <2.0.0-internal.6.3.0