Created error handler for node or browser