Adding console logging to try and trap errors in client code