RM: generic error catcher