Open bestform opened 8 years ago
In a lot of places, possible errors will just be given to the Check function, which logs the error and happily continues on. This can result in runtime errors. Some instances are:
https://github.com/ewhal/Pastebin/blob/8f7528cbc6513d647901e3784399b2442a74708f/pastebin.go#L89 Here it is just assumed that opening the database connection will be successful. It will log an error, should one happen, but it will blindly run into the call at line 92.
Same thing on https://github.com/ewhal/Pastebin/blob/8f7528cbc6513d647901e3784399b2442a74708f/pastebin.go#L182 and the following lines.
I think those errors could be handled more gracefully.
In addition, I'd recommend renaming the Check function into something like LogError. This way, it is obvious what the function actually does.
I did want to improve error handling at some point in time and I should probably get on that. Good idea with renaming Check to LogErrror.
In a lot of places, possible errors will just be given to the Check function, which logs the error and happily continues on. This can result in runtime errors. Some instances are:
https://github.com/ewhal/Pastebin/blob/8f7528cbc6513d647901e3784399b2442a74708f/pastebin.go#L89 Here it is just assumed that opening the database connection will be successful. It will log an error, should one happen, but it will blindly run into the call at line 92.
Same thing on https://github.com/ewhal/Pastebin/blob/8f7528cbc6513d647901e3784399b2442a74708f/pastebin.go#L182 and the following lines.
I think those errors could be handled more gracefully.
In addition, I'd recommend renaming the Check function into something like LogError. This way, it is obvious what the function actually does.