add exception handler for REST request