• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.DownloadHTTPError = exports.DownloadLengthMismatchError = exports.DownloadError = exports.ExpiredMetadataError = exports.EqualVersionError = exports.BadVersionError = exports.RepositoryError = exports.PersistError = exports.RuntimeError = exports.ValueError = void 0;
4// An error about insufficient values
5class ValueError extends Error {
6}
7exports.ValueError = ValueError;
8class RuntimeError extends Error {
9}
10exports.RuntimeError = RuntimeError;
11class PersistError extends Error {
12}
13exports.PersistError = PersistError;
14// An error with a repository's state, such as a missing file.
15// It covers all exceptions that come from the repository side when
16// looking from the perspective of users of metadata API or ngclient.
17class RepositoryError extends Error {
18}
19exports.RepositoryError = RepositoryError;
20// An error for metadata that contains an invalid version number.
21class BadVersionError extends RepositoryError {
22}
23exports.BadVersionError = BadVersionError;
24// An error for metadata containing a previously verified version number.
25class EqualVersionError extends BadVersionError {
26}
27exports.EqualVersionError = EqualVersionError;
28// Indicate that a TUF Metadata file has expired.
29class ExpiredMetadataError extends RepositoryError {
30}
31exports.ExpiredMetadataError = ExpiredMetadataError;
32//----- Download Errors -------------------------------------------------------
33// An error occurred while attempting to download a file.
34class DownloadError extends Error {
35}
36exports.DownloadError = DownloadError;
37// Indicate that a mismatch of lengths was seen while downloading a file
38class DownloadLengthMismatchError extends DownloadError {
39}
40exports.DownloadLengthMismatchError = DownloadLengthMismatchError;
41// Returned by FetcherInterface implementations for HTTP errors.
42class DownloadHTTPError extends DownloadError {
43    constructor(message, statusCode) {
44        super(message);
45        this.statusCode = statusCode;
46    }
47}
48exports.DownloadHTTPError = DownloadHTTPError;
49