globel error handler to prevent node crashing