fixing error-handling example and improving its documentation