catch errors with a default callback if none provided