Debian Codegraph @

ansible_collections/community/general/plugins/module_utils/_mh/exceptions.py

raw
1 # (c) 2020, Alexei Znamensky <[email protected]>
2 # Copyright (c) 2020, Ansible Project
3 # Simplified BSD License (see LICENSES/BSD-2-Clause.txt or https://opensource.org/licenses/BSD-2-Clause)
4 # SPDX-License-Identifier: BSD-2-Clause
5
6 # Note that this module util is **PRIVATE** to the collection. It can have breaking changes at any time.
7 # Do not use this from other collections or standalone plugins/modules!
8
9 from __future__ import annotations
10
11 import typing as t
12
13
14 class ModuleHelperException(Exception):
15 def __init__(self, msg: str, update_output: dict[str, t.Any] | None = None, *args, **kwargs) -> None:
16 self.msg: str = msg or f"Module failed with exception: {self}"
17 if update_output is None:
18 update_output = {}
19 self.update_output: dict[str, t.Any] = update_output
20 super().__init__(*args)
21
22
23 class _UnhandledSentinel(Exception):
24 pass