Skip to content

Commit

Permalink
refactor: refactor try_network_action() (DEV-1844) (#325)
Browse files Browse the repository at this point in the history
Until now, a parameter failure_msg had to be passed to try_network_action() . An error with this message was then raised if the network action failed, and the details of the error were logged inside try_network_action() . This architecture is subpar.

In the new architecture, try_network_action() only does its core job, and lets errors escalate. The caller is now responsible to log the original error and raise a new user-friendlier one.

When logging the original error inside an except clause, the additional parameter exc_info=True must be passed, so that the stack trace is also logged.

At the moment, the print() statements are still an important user feedback. Often, the same message is logged and then printed. This doubling is intentional.

This task concentrates only on try_network_action(), so there are now some modules where there are only some few log statements. This inconsistency will be addressed in a separate task; then, log statements will be added systematically.
  • Loading branch information
jnussbaum committed Mar 23, 2023
1 parent 5931307 commit 896586f
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 237 deletions.

0 comments on commit 896586f

Please sign in to comment.