better exception handling for programming