Coverage for sources/classcore/exceptions.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-01 22:29 +0000

1# vim: set filetype=python fileencoding=utf-8: 

2# -*- coding: utf-8 -*- 

3 

4#============================================================================# 

5# # 

6# Licensed under the Apache License, Version 2.0 (the "License"); # 

7# you may not use this file except in compliance with the License. # 

8# You may obtain a copy of the License at # 

9# # 

10# http://www.apache.org/licenses/LICENSE-2.0 # 

11# # 

12# Unless required by applicable law or agreed to in writing, software # 

13# distributed under the License is distributed on an "AS IS" BASIS, # 

14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # 

15# See the License for the specific language governing permissions and # 

16# limitations under the License. # 

17# # 

18#============================================================================# 

19 

20 

21''' Exceptions from package. ''' 

22 

23 

24from __future__ import annotations 

25 

26from . import __ 

27from . import standard as _standard 

28 

29 

30class Omniexception( # pyright: ignore[reportGeneralTypeIssues] 

31 BaseException, _standard.Object, 

32 instances_visibles = ( '__cause__', '__context__' ), # pyright: ignore[reportCallIssue] 

33): 

34 ''' Base exception for package. ''' 

35 

36 

37class Omnierror( Exception, Omniexception ): 

38 ''' Base error for package. ''' 

39 

40 

41class AttributeImmutability( AttributeError, Omnierror ): 

42 

43 def __init__( self, name: str, target: str ): 

44 super( ).__init__( 

45 f"Could not assign or delete attribute {name!r} on {target}." ) 

46 

47 

48class BehaviorExclusionInvalidity( TypeError, ValueError, Omnierror ): 

49 

50 def __init__( self, verifier: __.typx.Any ): 

51 super( ).__init__( 

52 f"Invalid behavior exclusion verifier: {verifier!r}" ) 

53 

54 

55class ErrorProvideFailure( RuntimeError, Omnierror ): 

56 

57 def __init__( self, name: str, reason: str ): 

58 super( ).__init__( 

59 f"Could not provide error class {name!r}. Reason: {reason}" )