Catch base Exception class instead of using bare except