Coverage for pyTooling / Exceptions / __init__.py: 100%
18 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-02-13 22:36 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-02-13 22:36 +0000
1# ==================================================================================================================== #
2# #
3# _____ _ _ _____ _ _ #
4# _ __ _ |_ _|__ ___ | (_)_ __ __ _ | ____|_ _____ ___ _ __ | |_(_) ___ _ __ ___ #
5# | '_ \| | | || |/ _ \ / _ \| | | '_ \ / _` | | _| \ \/ / __/ _ \ '_ \| __| |/ _ \| '_ \/ __| #
6# | |_) | |_| || | (_) | (_) | | | | | | (_| |_| |___ > < (_| __/ |_) | |_| | (_) | | | \__ \ #
7# | .__/ \__, ||_|\___/ \___/|_|_|_| |_|\__, (_)_____/_/\_\___\___| .__/ \__|_|\___/|_| |_|___/ #
8# |_| |___/ |___/ |_| #
9# ==================================================================================================================== #
10# Authors: #
11# Patrick Lehmann #
12# #
13# License: #
14# ==================================================================================================================== #
15# Copyright 2017-2026 Patrick Lehmann - Bötzingen, Germany #
16# #
17# Licensed under the Apache License, Version 2.0 (the "License"); #
18# you may not use this file except in compliance with the License. #
19# You may obtain a copy of the License at #
20# #
21# http://www.apache.org/licenses/LICENSE-2.0 #
22# #
23# Unless required by applicable law or agreed to in writing, software #
24# distributed under the License is distributed on an "AS IS" BASIS, #
25# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
26# See the License for the specific language governing permissions and #
27# limitations under the License. #
28# #
29# SPDX-License-Identifier: Apache-2.0 #
30# ==================================================================================================================== #
31#
32"""
33A common set of missing exceptions in Python.
35.. hint::
37 See :ref:`high-level help <EXECPTION>` for explanations and usage examples.
38"""
39from pyTooling.Decorators import export
42@export
43class OverloadResolutionError(Exception):
44 """
45 The exception is raised, when no matching overloaded method was found.
47 .. seealso::
49 :func:`@overloadable <pyTooling.MetaClasses.overloadable>`
50 |rarr| Mark a method as *overloadable*.
51 """
54@export
55class ExceptionBase(Exception):
56 """Base exception derived from :exc:`Exception <python:Exception>` for all custom exceptions."""
58 def __init__(self, message: str = "") -> None:
59 """
60 ExceptionBase initializer.
62 :param message: The exception message.
63 """
64 super().__init__()
65 self.message = message
67 def __str__(self) -> str:
68 """Returns the exception's message text."""
69 return self.message
71 # @DocumentMemberAttribute(False)
72 # @MethodAlias(pyExceptions.with_traceback)
73 # def with_traceback(self): pass
76@export
77class EnvironmentException(ExceptionBase):
78 """The exception is raised when an expected environment variable is missing."""
81@export
82class PlatformNotSupportedException(ExceptionBase):
83 """The exception is raise if the platform is not supported."""
86@export
87class NotConfiguredException(ExceptionBase):
88 """The exception is raise if the requested setting is not configured."""
91@export
92class ToolingException(Exception):
93 """The exception is raised by pyTooling internal features."""