orionis 0.670.0__py3-none-any.whl → 0.672.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orionis/console/core/reactor.py +44 -37
- orionis/failure/base/handler.py +23 -15
- orionis/failure/catch.py +3 -3
- orionis/failure/contracts/catch.py +1 -1
- orionis/failure/contracts/handler.py +8 -8
- orionis/failure/entities/throwable.py +1 -0
- orionis/metadata/framework.py +1 -1
- {orionis-0.670.0.dist-info → orionis-0.672.0.dist-info}/METADATA +1 -1
- {orionis-0.670.0.dist-info → orionis-0.672.0.dist-info}/RECORD +12 -12
- {orionis-0.670.0.dist-info → orionis-0.672.0.dist-info}/WHEEL +0 -0
- {orionis-0.670.0.dist-info → orionis-0.672.0.dist-info}/licenses/LICENCE +0 -0
- {orionis-0.670.0.dist-info → orionis-0.672.0.dist-info}/top_level.txt +0 -0
orionis/console/core/reactor.py
CHANGED
|
@@ -565,51 +565,58 @@ class Reactor(IReactor):
|
|
|
565
565
|
If the 'options' method does not return a list or contains non-CLIArgument instances.
|
|
566
566
|
"""
|
|
567
567
|
|
|
568
|
-
|
|
569
|
-
instance = self.__app.make(obj)
|
|
570
|
-
options: List[CLIArgument] = self.__app.call(instance, 'options')
|
|
571
|
-
|
|
572
|
-
# Validate that options is a list
|
|
573
|
-
if not isinstance(options, list):
|
|
574
|
-
raise CLIOrionisTypeError(
|
|
575
|
-
f"Command class {obj.__name__} 'options' must return a list."
|
|
576
|
-
)
|
|
568
|
+
try:
|
|
577
569
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
570
|
+
# Instantiate the command and retrieve its options
|
|
571
|
+
instance = self.__app.make(obj)
|
|
572
|
+
options: List[CLIArgument] = self.__app.call(instance, 'options')
|
|
581
573
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if not isinstance(arg, CLIArgument):
|
|
574
|
+
# Validate that options is a list
|
|
575
|
+
if not isinstance(options, list):
|
|
585
576
|
raise CLIOrionisTypeError(
|
|
586
|
-
f"Command class {obj.__name__} 'options' must
|
|
587
|
-
f"found '{type(arg).__name__}' at index {idx}."
|
|
577
|
+
f"Command class {obj.__name__} 'options' must return a list."
|
|
588
578
|
)
|
|
589
579
|
|
|
580
|
+
# Return None if there are no arguments
|
|
581
|
+
if not options:
|
|
582
|
+
return None
|
|
583
|
+
|
|
584
|
+
# Validate all items are CLIArgument instances
|
|
585
|
+
for idx, arg in enumerate(options):
|
|
586
|
+
if not isinstance(arg, CLIArgument):
|
|
587
|
+
raise CLIOrionisTypeError(
|
|
588
|
+
f"Command class {obj.__name__} 'options' must contain only CLIArgument instances, "
|
|
589
|
+
f"found '{type(arg).__name__}' at index {idx}."
|
|
590
|
+
)
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
# Get the Signature attribute from the command class
|
|
594
|
+
rf_concrete = ReflectionConcrete(obj)
|
|
595
|
+
signature = rf_concrete.getAttribute('signature', '<unknown>')
|
|
596
|
+
description = rf_concrete.getAttribute('description', '')
|
|
597
|
+
|
|
598
|
+
# Build the ArgumentParser
|
|
599
|
+
arg_parser = argparse.ArgumentParser(
|
|
600
|
+
usage=f"python -B reactor {signature} [options]",
|
|
601
|
+
description=f"Command [{signature}] : {description}",
|
|
602
|
+
formatter_class=argparse.RawTextHelpFormatter,
|
|
603
|
+
add_help=True,
|
|
604
|
+
allow_abbrev=False,
|
|
605
|
+
exit_on_error=True,
|
|
606
|
+
prog=signature
|
|
607
|
+
)
|
|
608
|
+
|
|
609
|
+
# Add each CLIArgument to the ArgumentParser
|
|
610
|
+
for arg in options:
|
|
611
|
+
arg.addToParser(arg_parser)
|
|
590
612
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
signature = rf_concrete.getAttribute('signature', '<unknown>')
|
|
594
|
-
description = rf_concrete.getAttribute('description', '')
|
|
595
|
-
|
|
596
|
-
# Build the ArgumentParser
|
|
597
|
-
arg_parser = argparse.ArgumentParser(
|
|
598
|
-
usage=f"python -B reactor {signature} [options]",
|
|
599
|
-
description=f"Command [{signature}] : {description}",
|
|
600
|
-
formatter_class=argparse.RawTextHelpFormatter,
|
|
601
|
-
add_help=True,
|
|
602
|
-
allow_abbrev=False,
|
|
603
|
-
exit_on_error=True,
|
|
604
|
-
prog=signature
|
|
605
|
-
)
|
|
613
|
+
# Return the constructed ArgumentParser
|
|
614
|
+
return arg_parser
|
|
606
615
|
|
|
607
|
-
|
|
608
|
-
for arg in options:
|
|
609
|
-
arg.addToParser(arg_parser)
|
|
616
|
+
except Exception as e:
|
|
610
617
|
|
|
611
|
-
|
|
612
|
-
|
|
618
|
+
# Raise a runtime error if any exception occurs during argument processing
|
|
619
|
+
raise CLIOrionisRuntimeError(e) from e
|
|
613
620
|
|
|
614
621
|
def __parseArgs(
|
|
615
622
|
self,
|
orionis/failure/base/handler.py
CHANGED
|
@@ -14,13 +14,13 @@ class BaseExceptionHandler(IBaseExceptionHandler):
|
|
|
14
14
|
# Example: OrionisContainerException
|
|
15
15
|
]
|
|
16
16
|
|
|
17
|
-
async def destructureException(self, exception:
|
|
17
|
+
async def destructureException(self, exception: Exception) -> Throwable:
|
|
18
18
|
"""
|
|
19
19
|
Converts an exception into a structured `Throwable` object containing detailed information.
|
|
20
20
|
|
|
21
21
|
Parameters
|
|
22
22
|
----------
|
|
23
|
-
e :
|
|
23
|
+
e : Exception
|
|
24
24
|
The exception instance to be destructured.
|
|
25
25
|
|
|
26
26
|
Returns
|
|
@@ -34,14 +34,22 @@ class BaseExceptionHandler(IBaseExceptionHandler):
|
|
|
34
34
|
and wraps them in a `Throwable` object for consistent error handling and reporting.
|
|
35
35
|
"""
|
|
36
36
|
|
|
37
|
+
# Safely extract the exception arguments, defaulting to an empty string if none are present
|
|
38
|
+
args = getattr(exception, 'args', None)
|
|
39
|
+
if not args:
|
|
40
|
+
args = ("",)
|
|
41
|
+
|
|
42
|
+
# Optionally, ensure all args are stringified for consistency
|
|
43
|
+
args = tuple(str(arg) for arg in args)
|
|
44
|
+
|
|
37
45
|
return Throwable(
|
|
38
|
-
classtype=type(exception),
|
|
39
|
-
message=
|
|
40
|
-
args=
|
|
41
|
-
traceback=exception.__traceback__ or traceback.format_exc()
|
|
46
|
+
classtype=type(exception), # The class/type of the exception
|
|
47
|
+
message=args[0], # The exception message as a string
|
|
48
|
+
args=args, # The arguments passed to the exception
|
|
49
|
+
traceback=exception.__traceback__ or traceback.format_exc() # The traceback object, if available
|
|
42
50
|
)
|
|
43
51
|
|
|
44
|
-
async def shouldIgnoreException(self, exception:
|
|
52
|
+
async def shouldIgnoreException(self, exception: Exception) -> bool:
|
|
45
53
|
"""
|
|
46
54
|
Determines if the exception should be ignored (not handled) by the handler.
|
|
47
55
|
|
|
@@ -57,7 +65,7 @@ class BaseExceptionHandler(IBaseExceptionHandler):
|
|
|
57
65
|
"""
|
|
58
66
|
|
|
59
67
|
# Ensure the provided object is an exception
|
|
60
|
-
if not isinstance(exception, BaseException):
|
|
68
|
+
if not isinstance(exception, (BaseException, Exception)):
|
|
61
69
|
raise TypeError(f"Expected BaseException, got {type(exception).__name__}")
|
|
62
70
|
|
|
63
71
|
# Convert the exception into a structured Throwable object
|
|
@@ -66,13 +74,13 @@ class BaseExceptionHandler(IBaseExceptionHandler):
|
|
|
66
74
|
# Check if the exception type is in the list of exceptions to ignore
|
|
67
75
|
return hasattr(self, 'dont_catch') and throwable.classtype in self.dont_catch
|
|
68
76
|
|
|
69
|
-
async def report(self, exception:
|
|
77
|
+
async def report(self, exception: Exception, log: ILogger) -> Any:
|
|
70
78
|
"""
|
|
71
79
|
Report or log an exception.
|
|
72
80
|
|
|
73
81
|
Parameters
|
|
74
82
|
----------
|
|
75
|
-
exception :
|
|
83
|
+
exception : Exception
|
|
76
84
|
The exception instance that was caught.
|
|
77
85
|
|
|
78
86
|
Returns
|
|
@@ -80,7 +88,7 @@ class BaseExceptionHandler(IBaseExceptionHandler):
|
|
|
80
88
|
None
|
|
81
89
|
"""
|
|
82
90
|
# Ensure the provided object is an exception
|
|
83
|
-
if not isinstance(exception, BaseException):
|
|
91
|
+
if not isinstance(exception, (BaseException, Exception)):
|
|
84
92
|
raise TypeError(f"Expected BaseException, got {type(exception).__name__}")
|
|
85
93
|
|
|
86
94
|
# Convert the exception into a structured Throwable object
|
|
@@ -92,13 +100,13 @@ class BaseExceptionHandler(IBaseExceptionHandler):
|
|
|
92
100
|
# Return the structured exception
|
|
93
101
|
return throwable
|
|
94
102
|
|
|
95
|
-
async def renderCLI(self, exception:
|
|
103
|
+
async def renderCLI(self, exception: Exception, request: ICLIRequest, log: ILogger, console: IConsole) -> Any:
|
|
96
104
|
"""
|
|
97
105
|
Render the exception message for CLI output.
|
|
98
106
|
|
|
99
107
|
Parameters
|
|
100
108
|
----------
|
|
101
|
-
exception :
|
|
109
|
+
exception : Exception
|
|
102
110
|
The exception instance that was caught.
|
|
103
111
|
|
|
104
112
|
Returns
|
|
@@ -106,8 +114,8 @@ class BaseExceptionHandler(IBaseExceptionHandler):
|
|
|
106
114
|
None
|
|
107
115
|
"""
|
|
108
116
|
# Ensure the provided object is an exception
|
|
109
|
-
if not isinstance(exception, BaseException):
|
|
110
|
-
raise TypeError(f"Expected
|
|
117
|
+
if not isinstance(exception, (BaseException, Exception)):
|
|
118
|
+
raise TypeError(f"Expected Exception, got {type(exception).__name__}")
|
|
111
119
|
|
|
112
120
|
# Ensure the request is a CLIRequest
|
|
113
121
|
if not isinstance(request, ICLIRequest):
|
orionis/failure/catch.py
CHANGED
|
@@ -41,7 +41,7 @@ class Catch(ICatch):
|
|
|
41
41
|
# Retrieve the console output service from the application container
|
|
42
42
|
self.__exception_handler: IBaseExceptionHandler = app.getExceptionHandler()
|
|
43
43
|
|
|
44
|
-
def exception(self, kernel: Any, request: Any, e: BaseException) -> None:
|
|
44
|
+
def exception(self, kernel: Any, request: Any, e: BaseException | Exception) -> None:
|
|
45
45
|
"""
|
|
46
46
|
Handles and reports exceptions that occur during CLI execution.
|
|
47
47
|
|
|
@@ -69,8 +69,8 @@ class Catch(ICatch):
|
|
|
69
69
|
"""
|
|
70
70
|
|
|
71
71
|
# If there is no exception handler, return early
|
|
72
|
-
if self.__app.call(self.__exception_handler, 'shouldIgnoreException', exception=e):
|
|
73
|
-
|
|
72
|
+
# if self.__app.call(self.__exception_handler, 'shouldIgnoreException', exception=e):
|
|
73
|
+
# return
|
|
74
74
|
|
|
75
75
|
# Report the exception using the exception handler and logger
|
|
76
76
|
self.__app.call(self.__exception_handler, 'report', exception=e)
|
|
@@ -4,7 +4,7 @@ from typing import Any
|
|
|
4
4
|
class ICatch(ABC):
|
|
5
5
|
|
|
6
6
|
@abstractmethod
|
|
7
|
-
def exception(self, kernel: Any, request: Any, e: BaseException) -> None:
|
|
7
|
+
def exception(self, kernel: Any, request: Any, e: BaseException | Exception) -> None:
|
|
8
8
|
"""
|
|
9
9
|
Handles and reports exceptions that occur during CLI execution.
|
|
10
10
|
|
|
@@ -7,13 +7,13 @@ from orionis.services.log.contracts.log_service import ILogger
|
|
|
7
7
|
class IBaseExceptionHandler:
|
|
8
8
|
|
|
9
9
|
@abstractmethod
|
|
10
|
-
async def destructureException(self, e:
|
|
10
|
+
async def destructureException(self, e: Exception):
|
|
11
11
|
"""
|
|
12
12
|
Converts an exception into a structured `Throwable` object containing detailed information.
|
|
13
13
|
|
|
14
14
|
Parameters
|
|
15
15
|
----------
|
|
16
|
-
e :
|
|
16
|
+
e : Exception
|
|
17
17
|
The exception instance to be destructured.
|
|
18
18
|
|
|
19
19
|
Returns
|
|
@@ -29,13 +29,13 @@ class IBaseExceptionHandler:
|
|
|
29
29
|
pass
|
|
30
30
|
|
|
31
31
|
@abstractmethod
|
|
32
|
-
async def shouldIgnoreException(self, e:
|
|
32
|
+
async def shouldIgnoreException(self, e: Exception) -> bool:
|
|
33
33
|
"""
|
|
34
34
|
Determines if the exception should be ignored (not handled) by the handler.
|
|
35
35
|
|
|
36
36
|
Parameters
|
|
37
37
|
----------
|
|
38
|
-
e :
|
|
38
|
+
e : Exception
|
|
39
39
|
The exception instance to check.
|
|
40
40
|
|
|
41
41
|
Returns
|
|
@@ -46,13 +46,13 @@ class IBaseExceptionHandler:
|
|
|
46
46
|
pass
|
|
47
47
|
|
|
48
48
|
@abstractmethod
|
|
49
|
-
async def report (self, exception:
|
|
49
|
+
async def report (self, exception: Exception, log: ILogger) -> Any:
|
|
50
50
|
"""
|
|
51
51
|
Report or log an exception.
|
|
52
52
|
|
|
53
53
|
Parameters
|
|
54
54
|
----------
|
|
55
|
-
exception :
|
|
55
|
+
exception : Exception
|
|
56
56
|
The exception instance that was caught.
|
|
57
57
|
|
|
58
58
|
Returns
|
|
@@ -62,13 +62,13 @@ class IBaseExceptionHandler:
|
|
|
62
62
|
pass
|
|
63
63
|
|
|
64
64
|
@abstractmethod
|
|
65
|
-
async def renderCLI(self, exception:
|
|
65
|
+
async def renderCLI(self, exception: Exception, request: ICLIRequest, log: ILogger, console: IConsole) -> Any:
|
|
66
66
|
"""
|
|
67
67
|
Render the exception message for CLI output.
|
|
68
68
|
|
|
69
69
|
Parameters
|
|
70
70
|
----------
|
|
71
|
-
exception :
|
|
71
|
+
exception : Exception
|
|
72
72
|
The exception instance that was caught.
|
|
73
73
|
|
|
74
74
|
Returns
|
|
@@ -30,4 +30,5 @@ class Throwable:
|
|
|
30
30
|
|
|
31
31
|
classtype: type # The type of the throwable (e.g., Exception class)
|
|
32
32
|
message: str # The error message associated with the throwable
|
|
33
|
+
args: tuple # Arguments passed to the throwable
|
|
33
34
|
traceback: Optional[str] = None # Optional traceback information as a string
|
orionis/metadata/framework.py
CHANGED
|
@@ -32,7 +32,7 @@ orionis/console/contracts/reactor.py,sha256=iT6ShoCutAWEeJzOf_PK7CGXi9TgrOD5tewH
|
|
|
32
32
|
orionis/console/contracts/schedule.py,sha256=xtXgp4BPhvhg3YSM4mrIdbyoBdr4OJBi1gBM_kJN5UQ,13694
|
|
33
33
|
orionis/console/contracts/schedule_event_listener.py,sha256=h06qsBxuEMD3KLSyu0JXdUDHlQW19BX9lA09Qrh2QXg,3818
|
|
34
34
|
orionis/console/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
|
-
orionis/console/core/reactor.py,sha256=
|
|
35
|
+
orionis/console/core/reactor.py,sha256=qctLns-f5eB9Air7Qi4hvX5KB5A7SsHeV8M5zYJEiPA,44286
|
|
36
36
|
orionis/console/debug/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
37
|
orionis/console/debug/dumper.py,sha256=vbmP_GlrzBj0KDjiQl4iDudPRe6V0W5r5UA8i3h9_c4,6555
|
|
38
38
|
orionis/console/dynamic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -84,14 +84,14 @@ orionis/container/facades/facade.py,sha256=c9V4ywJCdux1oluzVc7ph_8-TY2Nc85k3_UeQ
|
|
|
84
84
|
orionis/container/providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
85
85
|
orionis/container/providers/service_provider.py,sha256=OlqmBIkZSDZHJ_JZvwhNiMMrn-GzeIoCgR-HdsqGOVM,2385
|
|
86
86
|
orionis/failure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
87
|
-
orionis/failure/catch.py,sha256=
|
|
87
|
+
orionis/failure/catch.py,sha256=EMRWQ3liYnQoyhCCvPu7nzfnWmJwKIKsPtMiGWP107o,3302
|
|
88
88
|
orionis/failure/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
|
-
orionis/failure/base/handler.py,sha256=
|
|
89
|
+
orionis/failure/base/handler.py,sha256=5B6IxbGDWol7cZu7-TOrO2SXb58ozTeg1GHk6FAFkP0,5136
|
|
90
90
|
orionis/failure/contracts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
91
|
-
orionis/failure/contracts/catch.py,sha256=
|
|
92
|
-
orionis/failure/contracts/handler.py,sha256=
|
|
91
|
+
orionis/failure/contracts/catch.py,sha256=HCMcz08A2F_A8GoTpI4p3u7-ZqnyJXaJhP1fcFIY52w,1205
|
|
92
|
+
orionis/failure/contracts/handler.py,sha256=6HWe9aQKTnGHaGb8ttsaQTJO1vSiXhZDkIDvb9-sWWU,2208
|
|
93
93
|
orionis/failure/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
94
|
-
orionis/failure/entities/throwable.py,sha256=
|
|
94
|
+
orionis/failure/entities/throwable.py,sha256=m1DroY-SaxrJsQ8PW496lvMRIWDU8vaveGNI7CGzQGU,1313
|
|
95
95
|
orionis/foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
96
96
|
orionis/foundation/application.py,sha256=33Z6-0iT7pbZw74zHRV_z_6CLUO-huIfkd236zl0wP4,93824
|
|
97
97
|
orionis/foundation/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -206,7 +206,7 @@ orionis/foundation/providers/scheduler_provider.py,sha256=IrPQJwvQVLRm5Qnz0Cxon4
|
|
|
206
206
|
orionis/foundation/providers/testing_provider.py,sha256=eI1p2lUlxl25b5Z487O4nmqLE31CTDb4c3Q21xFadkE,1615
|
|
207
207
|
orionis/foundation/providers/workers_provider.py,sha256=GdHENYV_yGyqmHJHn0DCyWmWId5xWjD48e6Zq2PGCWY,1674
|
|
208
208
|
orionis/metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
209
|
-
orionis/metadata/framework.py,sha256=
|
|
209
|
+
orionis/metadata/framework.py,sha256=eMXy0dxPBfl1IqUyX23hng2Vfk04cmMg_2HHsZLCr5M,4089
|
|
210
210
|
orionis/metadata/package.py,sha256=s1JeGJPwdVh4jO3IOfmpwMuJ_oX6Vf9NL7jgPEQNf5Y,16050
|
|
211
211
|
orionis/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
212
212
|
orionis/services/asynchrony/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -393,8 +393,8 @@ orionis/test/validators/workers.py,sha256=rWcdRexINNEmGaO7mnc1MKUxkHKxrTsVuHgbnI
|
|
|
393
393
|
orionis/test/view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
394
394
|
orionis/test/view/render.py,sha256=arysoswhkV2vUd2aVMZRPpmH317jaWbgjDpQ_AWQ5AE,5663
|
|
395
395
|
orionis/test/view/report.stub,sha256=QLqqCdRoENr3ECiritRB3DO_MOjRQvgBh5jxZ3Hs1r0,28189
|
|
396
|
-
orionis-0.
|
|
397
|
-
orionis-0.
|
|
398
|
-
orionis-0.
|
|
399
|
-
orionis-0.
|
|
400
|
-
orionis-0.
|
|
396
|
+
orionis-0.672.0.dist-info/licenses/LICENCE,sha256=JhC-z_9mbpUrCfPjcl3DhDA8trNDMzb57cvRSam1avc,1463
|
|
397
|
+
orionis-0.672.0.dist-info/METADATA,sha256=pzALGHPw_H9_MsP7awPsyS8yrki6VRqbJHt5QjnuTwU,4772
|
|
398
|
+
orionis-0.672.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
399
|
+
orionis-0.672.0.dist-info/top_level.txt,sha256=lyXi6jArpqJ-0zzNqd_uwsH-z9TCEBVBL-pC3Ekv7hU,8
|
|
400
|
+
orionis-0.672.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|