Closed densnow closed 5 months ago
Good idea. Could you please liaise with Steve about the errors he had and then work on this?
Additionally, there should be a message if the %linter on
command can't run the corresponding linter.
Looking at the ruff docs regarding exit codes it returns:
This explains why we cannot just use the check=True
option in subprocess.run
in %ruff
. If we want to distinguish between violations and abnormal termination we have to check the returncode
attribute of the result from subprocess.run()
To summarise so far:
For the latter, would be good to catch the subprocess exit code and handle it appropriately.
The linter errors are dealt as part of #29.
Since
time_it()
,time_cases()
, andtime_functions()
are higher-order functions, the source of any errors can be obscured.To make it easier for the user to trace errors, we can catch exceptions and print additional information about the state of any functions involved in the error.
It might be best to catch exceptions in
time_it()
like the followingand then in
time_cases()
like:And something similar in
time_functions()
. The exact details might need to change, but the idea is to pass on specific information about the state of the arguments that could be useful.