/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { IErrorBase, ITelemetryBaseProperties } from "@fluidframework/core-interfaces"; import { type IGenericError, type ILayerIncompatibilityError, type IUsageError } from "@fluidframework/core-interfaces/internal"; import type { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal"; import { LoggingError } from "./errorLogging.js"; import type { IFluidErrorBase } from "./fluidErrorBase.js"; import type { ITelemetryPropertiesExt } from "./telemetryTypes.js"; /** * A subset of `ISequencedDocumentMessage` properties that are safe to log for telemetry. * @internal */ export type MessageLike = Partial>; /** * Throws a UsageError with the given message if the condition is not met. * Use this API when `false` indicates a precondition is not met on a public API (for any FF layer). * * @param condition - The condition that should be true, if the condition is false a UsageError will be thrown. * @param message - The message to include in the error when the condition does not hold. * @param props - Telemetry props to include on the error when the condition does not hold. * @internal */ export declare function validatePrecondition(condition: boolean, message: string, props?: ITelemetryBaseProperties): asserts condition; /** * Generic wrapper for an unrecognized/uncategorized error object * * @internal */ export declare class GenericError extends LoggingError implements IGenericError, IFluidErrorBase { readonly error?: any; readonly errorType: "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?: ITelemetryBaseProperties); } /** * Error indicating an API is being used improperly resulting in an invalid operation. * * @internal */ export declare class UsageError extends LoggingError implements IUsageError, IFluidErrorBase { readonly errorType: "usageError"; constructor(message: string, props?: ITelemetryBaseProperties); } /** * 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 * * @internal */ export declare class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase { readonly errorType: "dataCorruptionError"; readonly canRetry = false; constructor(message: string, props: ITelemetryBaseProperties); /** * Create a new `DataCorruptionError` detected and raised within the Fluid Framework. */ static create(errorMessage: string, dataCorruptionCodepath: string, messageLike?: MessageLike, props?: ITelemetryPropertiesExt, stackTraceLimit?: number): IFluidErrorBase; } /** * Indicates we hit a fatal error while processing incoming data from the Fluid Service. * * @remarks * * The error will often originate in the dataStore or DDS implementation that is responding to incoming changes. * This differs from {@link DataCorruptionError} in that this may be a transient error that will not repro in another * client or session. * * @internal */ export declare class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase { /** * {@inheritDoc IFluidErrorBase.errorType} */ readonly errorType: "dataProcessingError"; readonly canRetry = false; private constructor(); /** * Create a new `DataProcessingError` detected and raised within the Fluid Framework. */ static create(errorMessage: string, dataProcessingCodepath: string, messageLike?: MessageLike, props?: ITelemetryPropertiesExt, stackTraceLimit?: number): IFluidErrorBase; /** * Wrap the given error in a `DataProcessingError`, unless the error is already of a known type * with the exception of a normalized {@link LoggingError}, which will still be wrapped. * * In either case, the error will have some relevant properties added for telemetry. * * @remarks See `wrapDataProcessingErrorIfUnrecognized` for details on wrapping behavior. * * @param originalError - The error to be converted. * @param dataProcessingCodepath - Which code-path failed while processing data. * @param messageLike - 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: unknown, dataProcessingCodepath: string, messageLike?: MessageLike): IFluidErrorBase; } /** * Error indicating that two Fluid layers are incompatible. * See {@link @fluidframework/core-interfaces#ILayerIncompatibilityError} for more details. * * @internal */ export declare class LayerIncompatibilityError extends LoggingError implements ILayerIncompatibilityError { readonly errorType: "layerIncompatibilityError"; readonly layer: string; readonly layerVersion: string; readonly incompatibleLayer: string; readonly incompatibleLayerVersion: string; readonly compatibilityRequirementsInMonths: number; readonly actualDifferenceInMonths: number; readonly details: string; constructor(message: string, incompatibilityProps: { layer: string; layerVersion: string; incompatibleLayer: string; incompatibleLayerVersion: string; compatibilityRequirementsInMonths: number; actualDifferenceInMonths: number; details: string; }, telemetryProps?: ITelemetryBaseProperties); } /** * Extracts specific properties from the provided message that we know are safe to log. * * @param messageLike - Message to include info about via telemetry props. * * @internal */ export declare const extractSafePropertiesFromMessage: (messageLike: MessageLike) => { messageClientId: string | undefined; messageSequenceNumber: number | undefined; messageClientSequenceNumber: number | undefined; messageReferenceSequenceNumber: number | undefined; messageMinimumSequenceNumber: number | undefined; messageTimestamp: number | undefined; }; //# sourceMappingURL=error.d.ts.map