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