isolate exception and add console logging