import { IIdpUser } from "../entities/User" ; export class AuthenticationRequiredError extends Error { constructor ( ) { super ( "This operation requires the request to be authenticated" ) ; } } export class NoUserCorrespondingToIdpUserError extends Error { constructor ( idpUser ) { super ( `Access denied. To gain access, ask an admin to create a user with idp = ${ idpUser . idp } and idpId = ${ idpUser . id }` ) ; } } export class MissingRoleError extends Error { constructor ( ) { super ( "The user doesn't have the necessary roles to perform this operation" ) ; } } export class ConfigurationNotValidError extends Error { constructor ( configurationProperty ) { super ( `${ configurationProperty } is not a valid configuration object` ) ; } } export class AppNameNotValidError extends Error { constructor ( name ) { super ( `${ name } is not a valid name for an app` ) ; } } export class AppNotFoundError extends Error { constructor ( searchValue , searchProperty ) { super ( `No app found with ${ searchProperty } = ${ searchValue }` ) ; } } export class ConflictingAppError extends Error { constructor ( name ) { super ( `An app with name = ${ name } already exists` ) ; } } export class AppHasEntrypointsError extends Error { constructor ( id ) { super ( `Can't delete app with id = ${ id } because it has linked entrypoints` ) ; } } export class BundleNameOrTagNotValidError extends Error { constructor ( nameOrTag , type ) { super ( `${ nameOrTag } is not a valid ${ type } for a bundle` ) ; } } export class BundleNameTagCombinationNotValidError extends Error { constructor ( nameTagCombination ) { super ( `${ nameTagCombination } is not a valid name:tag combination for a bundle` ) ; } } export class BundleFallbackAssetNotFoundError extends Error { constructor ( fallbackAssetPath ) { super ( `Asset ${ fallbackAssetPath } not found in bundle, cannot be set as fallback asset` ) ; } } export class BundleNotFoundError extends Error { constructor ( searchValue , searchProperty ) { super ( `No bundle found with ${ searchProperty } = ${ searchValue }` ) ; } } export class BundlesInUseError extends Error { constructor ( ids ) { const bundlesIdsString = ids . join ( ", " ) ; super ( `Can't delete bundles with ids = [ ${ bundlesIdsString } ], as one or more of them are being used by some entrypoints` ) ; } } export class ArchiveCreationError extends Error { constructor ( ) { super ( "Error creating archive from files" ) ; } } export class ArchiveExtractionError extends Error { constructor ( ) { super ( "Error extracting files from archive" ) ; } } export class EntrypointUrlMatcherNotValidError extends Error { constructor ( urlMatcher ) { super ( `${ urlMatcher } is not a valid urlMatcher for an entrypoint` ) ; } } export class EntrypointNotFoundError extends Error { constructor ( searchValue , searchProperty ) { super ( `No entrypoint found with ${ searchProperty } = ${ searchValue }` ) ; } } export class ConflictingEntrypointError extends Error { constructor ( urlMatcher ) { super ( `An entrypoint with urlMatcher = ${ urlMatcher } already exists` ) ; } } export class EntrypointMismatchedAppIdError extends Error { constructor ( entrypointUrlMatcher , appName ) { super ( `Entrypoint with urlMatcher = ${ entrypointUrlMatcher } doesn't link to app with name = ${ appName }` ) ; } } export class NoMatchingEntrypointError extends Error { constructor ( public requestedUrl ) { super ( `No entrypoint found matching requestedUrl = ${ requestedUrl }` ) ; } } export class NoBundleOrRedirectToError extends Error { constructor ( public matchingEntrypointUrlMatcher ) { super ( `Entrypoint with urlMatcher = ${ matchingEntrypointUrlMatcher } doesn't specify neither a bundle to serve nor a location to redirect to` ) ; } } export class GroupNotFoundError extends Error { constructor ( id ) { super ( `No group found with id = ${ id }` ) ; } } export class SomeGroupNotFoundError extends Error { constructor ( ids ) { const idsString = ids . join ( ", " ) ; super ( `Not all ids = [ ${ idsString } ] correspond to an existing group` ) ; } } export class ConflictingGroupError extends Error { constructor ( name ) { super ( `A group with name = ${ name } already exists` ) ; } } export class GroupHasUsersError extends Error { constructor ( id ) { super ( `Can't delete group with id = ${ id } because it has linked users` ) ; } } export class RoleNotValidError extends Error { constructor ( role ) { super ( `${ role } is not a valid role` ) ; } } export class UserNotFoundError extends Error { constructor ( id ) { super ( `No user found with id = ${ id }` ) ; } } export class ConflictingUserError extends Error { constructor ( idp , idpId ) { super ( `A user with idp = ${ idp } and idpId = ${ idpId } already exists` ) ; } } export class StoragesSetupError extends Error { constructor ( message , public originalError ) { super ( message ) ; } } export class GenericStoragesError extends Error { constructor ( public originalError ) { super ( "An error occurred while accessing StaticDeploy's storage" ) ; } } export class StoragesInconsistencyError extends Error { }