Minor: move common code to finally block
Show stacktrace for errors from js