Nutrient Web SDK

Function SaveError

A save error indicates a problem with saving. It is a subclass of NutrientViewer.Error that behaves like a regular JavaScript error.

Function
Type Signature
SaveError<T = unknown>(messageOrError: string | Error, reason: { … }[]): Error
  • Type Declaration

    Type Parameters

    T = unknown

    Parameters

    messageOrErrorstring | Error
    reason
    { … }[]
    • error: Error

      Reason of the save failure.

    • modificationType: "CREATED" | "UPDATED" | "DELETED"

      modificationType Type of modification that was being saved.

    • object: T

      Object that was being saved.

    Returns

    Example

    try {
    await instance.save();
    } catch (error) {
    (error instanceof NutrientViewer.SaveError); // => true
    error.message; // Useful error message
    error.reason; // Array of errors for changes that could not be saved.
    }

    @class

Properties