1#!/usr/bin/env python3 2# 3# Copyright 2018 - The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16"""Define errors that are raised by AIDEgen.""" 17 18 19class AIDEgenError(Exception): 20 """Base AIDEgen exception.""" 21 22 23class BuildFailureError(AIDEgenError): 24 """Raised when a build failed.""" 25 26 27class GenerateIDEProjectFileError(AIDEgenError): 28 """Raised when IDE project files are not generated.""" 29 30 31class JsonFileNotExistError(AIDEgenError): 32 """Raised when a json file does not exist.""" 33 34 35class EmptyModuleDependencyError(AIDEgenError): 36 """Raised when the module dependency is empty. Note that even 37 a standalone module without jar dependency shall have its src path as 38 dependency. 39 """ 40 41 42class ProjectOutsideAndroidRootError(AIDEgenError): 43 """Raised when a project to be generated IDE project file is not under 44 source tree's root directory.""" 45 46 47class ProjectPathNotExistError(AIDEgenError): 48 """Raised when a project path does not exist.""" 49 50 51class NoModuleDefinedInModuleInfoError(AIDEgenError): 52 """Raised when a module is not defined in module-info.json.""" 53 54 55class IDENotExistError(AIDEgenError): 56 """Raised if no IDE exists in a specific path.""" 57 58 59class FakeModuleError(AIDEgenError): 60 """Raised if the module is a fake module.""" 61 62 63class InvalidXMLError(AIDEgenError): 64 """Raised if parsing xml file failed.""" 65 66 67class InstanceNotExistError(AIDEgenError): 68 """Raised if instance does not exist.""" 69 70 71class ModuleInfoEmptyError(AIDEgenError): 72 """Raised if module's info dictionary is empty.""" 73 74 75class NoModuleNameDefinedInModuleInfoError(AIDEgenError): 76 """Raised if 'module_name' key isn't defined in module's info dictionary.""" 77 78 79class NoPathDefinedInModuleInfoError(AIDEgenError): 80 """Raised if 'path' key isn't defined in module's info dictionary.""" 81 82 83# The following error is used by aidegen_functional_test module. 84class CommitIDNotExistError(AIDEgenError): 85 """Raised if the commit id doesn't exist.""" 86