     stack: this.stack,
    };
  }

  /**
   * @param {SerializedBackupError} serialized
   *   Worker error serialized by PromiseWorker
   * @returns {BackupError}
   */
  static fromMsg(serialized) {
    let error = new BackupError(serialized.message, serialized.cause);
    error.stack = serialized.stack;
    return error;
  }
}
PK