Skip to content

Commit

Permalink
Standardize exception variables
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Oct 29, 2023
1 parent 75e7dac commit a7e785e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions nautilus_trader/backtest/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ def run(self) -> list[BacktestResult]:
batch_size_bytes=config.batch_size_bytes,
)
results.append(result)
except Exception as ex:
except Exception as e:
# Broad catch all prevents a single backtest run from halting
# the execution of the other backtests (such as a zero balance exception).
print(f"Error running {config}: {ex}")
print(f"Error running {config}: {e}")

return results

Expand Down
16 changes: 8 additions & 8 deletions nautilus_trader/live/data_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ async def _run_cmd_queue(self) -> None:
self._execute_command(command)
except asyncio.CancelledError:
self._log.warning("DataCommand message queue canceled.")
except RuntimeError as ex:
self._log.error(f"RuntimeError: {ex}.")
except RuntimeError as e:
self._log.error(f"RuntimeError: {e}.")
finally:
stopped_msg = "DataCommand message queue stopped"
if not self._cmd_queue.empty():
Expand All @@ -405,8 +405,8 @@ async def _run_req_queue(self) -> None:
self._handle_request(request)
except asyncio.CancelledError:
self._log.warning("DataRequest message queue canceled.")
except RuntimeError as ex:
self._log.error(f"RuntimeError: {ex}.")
except RuntimeError as e:
self._log.error(f"RuntimeError: {e}.")
finally:
stopped_msg = "DataRequest message queue stopped"
if not self._req_queue.empty():
Expand All @@ -426,8 +426,8 @@ async def _run_res_queue(self) -> None:
self._handle_response(response)
except asyncio.CancelledError:
self._log.warning("DataResponse message queue canceled.")
except RuntimeError as ex:
self._log.error(f"RuntimeError: {ex}.")
except RuntimeError as e:
self._log.error(f"RuntimeError: {e}.")
finally:
stopped_msg = "DataResponse message queue stopped"
if not self._res_queue.empty():
Expand All @@ -445,8 +445,8 @@ async def _run_data_queue(self) -> None:
self._handle_data(data)
except asyncio.CancelledError:
self._log.warning("Data message queue canceled.")
except RuntimeError as ex:
self._log.error(f"RuntimeError: {ex}.")
except RuntimeError as e:
self._log.error(f"RuntimeError: {e}.")
finally:
stopped_msg = "Data message queue stopped"
if not self._data_queue.empty():
Expand Down
8 changes: 4 additions & 4 deletions nautilus_trader/live/execution_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ async def _run_cmd_queue(self) -> None:
self._execute_command(command)
except asyncio.CancelledError:
self._log.warning("Command message queue canceled.")
except RuntimeError as ex:
self._log.error(f"RuntimeError: {ex}.")
except RuntimeError as e:
self._log.error(f"RuntimeError: {e}.")
finally:
stopped_msg = "Command message queue stopped"
if not self._cmd_queue.empty():
Expand All @@ -384,8 +384,8 @@ async def _run_evt_queue(self) -> None:
self._handle_event(event)
except asyncio.CancelledError:
self._log.warning("Event message queue canceled.")
except RuntimeError as ex:
self._log.error(f"RuntimeError: {ex}.")
except RuntimeError as e:
self._log.error(f"RuntimeError: {e}.")
finally:
stopped_msg = "Event message queue stopped"
if not self._evt_queue.empty():
Expand Down
8 changes: 4 additions & 4 deletions nautilus_trader/live/risk_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ async def _run_cmd_queue(self) -> None:
self._execute_command(command)
except asyncio.CancelledError:
self._log.warning("Command message queue canceled.")
except RuntimeError as ex:
self._log.error(f"RuntimeError: {ex}.")
except RuntimeError as e:
self._log.error(f"RuntimeError: {e}.")
finally:
stopped_msg = "Command message queue stopped"
if not self._cmd_queue.empty():
Expand All @@ -270,8 +270,8 @@ async def _run_evt_queue(self) -> None:
self._handle_event(event)
except asyncio.CancelledError:
self._log.warning("Event message queue canceled.")
except RuntimeError as ex:
self._log.error(f"RuntimeError: {ex}.")
except RuntimeError as e:
self._log.error(f"RuntimeError: {e}.")
finally:
stopped_msg = "Event message queue stopped"
if not self._evt_queue.empty():
Expand Down

0 comments on commit a7e785e

Please sign in to comment.