2424
2525Error Handling:
2626 - The `ResultErr` class captures error messages, codes, and optional traceback information.
27- - Errors only raise an exception when requested (`expect` or `raised ` methods).
27+ - Errors only raise an exception when requested (`expect` or `raises ` methods).
2828
2929Constructors:
3030 Result(value, success=True, error_msg="", error_code=1, error_code_group=1):
185185 "Err_msg" ,
186186 "Err_code" ,
187187 "Err_traceback" ,
188- "raised " ,
188+ "raises " ,
189189 "expect" ,
190190 "expect_Err" ,
191191 "unwrap" ,
@@ -427,7 +427,7 @@ class ResultErr(Exception):
427427 error (bool): Returns true if in error status (ie, size > 0).
428428
429429 Methods:
430- raised (note=""):
430+ raises (note=""):
431431 Raise a ResultErr exception if error messages exist
432432 and optionally add the note to the end of exception.
433433
@@ -469,23 +469,23 @@ class ResultErr(Exception):
469469 >>> err = ResultErr() # empty error
470470 >>> print(err.error)
471471 False
472- >>> err.raised () # Nothing happens
472+ >>> err.raises () # Nothing happens
473473 >>>
474474 >>> err.append("bad input")
475- >>> err.raised () # program terminates
475+ >>> err.raises () # program terminates
476476 ResultErr: bad input
477477
478478 >>> err = ResultErr("bad input") # Initialized with an error
479479 >>> print(err.error)
480480 True
481- >>> err.raised () # program terminals
481+ >>> err.raises () # program terminals
482482 ResultErr: bad input
483483
484484 >>> err = ResultErr("bad input 1") # Initialized with an error
485485 >>> err.append("bad input 2") # Second error message
486486 >>> print(err.error)
487487 True
488- >>> err.raised () # program terminates
488+ >>> err.raises () # program terminates
489489 ResultErr:
490490 bad input 1
491491 bad input 2
@@ -618,7 +618,7 @@ def error_code_description(self, description=None, error_code_group=None):
618618 return self .__class__ ._error_codes [g ]
619619 return self .__class__ ._error_codes [g ][description ]
620620
621- def raised (self , note = "" ):
621+ def raises (self , note = "" ):
622622 """
623623 Raise a ResultErr exception if there are error messages.
624624
@@ -631,7 +631,7 @@ def raised(self, note=""):
631631 raise self
632632
633633 def expect (self , error_msg = "" ):
634- self .raised (error_msg )
634+ self .raises (error_msg )
635635 return ResultErr ()
636636
637637 def unwrap (self , * args , ** kwargs ):
@@ -858,7 +858,7 @@ class Result:
858858 If Ok variant, then raise ResultErr(ok_msg);
859859 If Err variant, then returns error in Err(error), which is type ResultErr.
860860
861- raised (error_msg="", exception=None):
861+ raises (error_msg="", exception=None):
862862 If Ok variant, then returns Ok(value);
863863 If Err variant, then raise Err and optionally include `from exception`.
864864 Useful for check during chained operations
@@ -1075,7 +1075,7 @@ def expect_Err(self, ok_msg="", error_code=5): # 5 -> ResultErr.error_code("Exp
10751075 err .append (ok_msg , add_traceback = False )
10761076 raise ResultErr (err )
10771077
1078- def raised (self , error_msg = "" , exception : Exception = None ):
1078+ def raises (self , error_msg = "" , exception : Exception = None ):
10791079 self ._empty_error ()
10801080 if not self ._success :
10811081 if error_msg != "" :
@@ -1371,14 +1371,14 @@ def method(*args, **kwargs):
13711371 res = attr (* args , ** kwargs )
13721372 return Result (res ) if res is not None else None
13731373 except Exception as e :
1374- return Result .Err (f"VAR.{ name } () raised { e } " , self .error_code ("Method" ), self ._g )
1374+ return Result .Err (f"VAR.{ name } () raises { e } " , self .error_code ("Method" ), self ._g )
13751375
13761376 return method
13771377 if isinstance (attr , Result ):
13781378 return attr
13791379 return Result (attr )
13801380 except AttributeError :
1381- self .add_Err_msg (f"VAR.{ name } raised an AttributeError" , self .error_code ("Attribute" ))
1381+ self .add_Err_msg (f"VAR.{ name } raises an AttributeError" , self .error_code ("Attribute" ))
13821382 return self
13831383
13841384 def __iter__ (self ):
0 commit comments