1# Copyright 2015 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5from py_utils import cloud_storage 6 7 8CloudStorageError = cloud_storage.CloudStorageError 9 10 11class UnsupportedConfigFormatError(ValueError): 12 def __init__(self, config_type, config_file): 13 if not config_type: 14 message = ('The json file at %s is unsupported by the dependency_manager ' 15 'due to no specified config type' % config_file) 16 else: 17 message = ('The json file at %s has config type %s, which is unsupported ' 18 'by the dependency manager.' % (config_file, config_type)) 19 super(UnsupportedConfigFormatError, self).__init__(message) 20 21 22class EmptyConfigError(ValueError): 23 def __init__(self, file_path): 24 super(EmptyConfigError, self).__init__('Empty config at %s.' % file_path) 25 26 27class FileNotFoundError(Exception): 28 def __init__(self, file_path): 29 super(FileNotFoundError, self).__init__('No file found at %s' % file_path) 30 31 32class NoPathFoundError(Exception): 33 def __init__(self, dependency, platform): 34 super(NoPathFoundError, self).__init__( 35 'No file could be found locally, and no file to download from cloud ' 36 'storage for %s on platform %s' % (dependency, platform)) 37 38 39class ReadWriteError(Exception): 40 pass 41 42 43class CloudStorageUploadConflictError(CloudStorageError): 44 def __init__(self, bucket, path): 45 super(CloudStorageUploadConflictError, self).__init__( 46 'File location %s already exists in bucket %s' % (path, bucket)) 47 48 49class ArchiveError(Exception): 50 def __init__(self, msg): 51 super(ArchiveError, self).__init__(msg) 52 53