This repository has been archived by the owner on Jul 25, 2022. It is now read-only.
reduce usage of checkError to make it possible to write tests #458
Labels
lifecycle/rotten
Nobody worked on this for 12 months (final aging stage)
We have a very generic function
checkError
inutils.go
file.The fatal flaw of this function that if there a non-nil error then it call for
log.Fatalf(err.Error())
and exit.It's mean that if this function is used somewhere then it makes it not possible to test the calling function because it will exit during the test execution.
It also prevents us from doing some cleaning after the executions if we created some files or other stateful manipulations.
A generic approach would be to check for errors during the code flow and if there is an error then pass it up to the stack call.
Somewhere at the very top of the call chain, we can execute this function and finally exit if there an error.
At the moment we call this function 394 times
The text was updated successfully, but these errors were encountered: