Moved exception logging into the try-catch

No more 'Exception thrown without stack frame at line 0'