@@ -117,7 +117,7 @@ async def _matrix_to_zulip(self, room: nio.MatrixRoom, event: nio.Event) -> None
117117 )
118118 except Exception as exception :
119119 # Generally raised when user is forbidden
120- raise BridgeFatalZulipError (exception )
120+ raise BridgeFatalZulipError (exception ) from exception
121121 if result ["result" ] != "success" :
122122 # Generally raised when API key is invalid
123123 raise BridgeFatalZulipError (result ["msg" ])
@@ -459,7 +459,7 @@ def read_configuration(config_file: str) -> Dict[str, Dict[str, Any]]:
459459 try :
460460 config .read (config_file )
461461 except configparser .Error as exception :
462- raise BridgeConfigError (str (exception ))
462+ raise BridgeConfigError (str (exception )) from exception
463463
464464 if set (config .sections ()) < {"matrix" , "zulip" }:
465465 raise BridgeConfigError ("Please ensure the configuration has zulip & matrix sections." )
@@ -619,14 +619,16 @@ def write_sample_config(target_path: str, zuliprc: Optional[str]) -> None:
619619 try :
620620 zuliprc_config .read (zuliprc )
621621 except configparser .Error as exception :
622- raise BridgeConfigError (str (exception ))
622+ raise BridgeConfigError (str (exception )) from exception
623623
624624 try :
625625 sample_dict ["zulip" ]["email" ] = zuliprc_config ["api" ]["email" ]
626626 sample_dict ["zulip" ]["site" ] = zuliprc_config ["api" ]["site" ]
627627 sample_dict ["zulip" ]["api_key" ] = zuliprc_config ["api" ]["key" ]
628628 except KeyError as exception :
629- raise BridgeConfigError ("You provided an invalid zuliprc file: " + str (exception ))
629+ raise BridgeConfigError (
630+ "You provided an invalid zuliprc file: " + str (exception )
631+ ) from exception
630632
631633 sample : configparser .ConfigParser = configparser .ConfigParser ()
632634 sample .read_dict (sample_dict )
0 commit comments