Add console logging and error passthrough, so that it works better with promises