英文:
How to suppress error messages which is coming from other procedure? - PROGRESS 4GL
问题
I am using below query to catch errors but I don't want to use these procedures. Instead, I need to suppress the error messages which should not throw during run time.
使用以下查询来捕获错误,但我不想使用这些过程。相反,我需要抑制不应在运行时抛出的错误消息。
英文:
I am using below query to catch errors but I don't want to use these procedures. Instead, I need to suppress the error messages which should not throw during run time.
DO ON ERROR UNDO, THROW:
FIND Customer 1000.
END.
CATCH eAnyError AS Progress.Lang.Error:
MESSAGE
"Error Number:~t" eAnyError:GetMessageNum(1) "~n"
"Error Text:~t" eAnyError:GetMessage(1)
VIEW-AS ALERT-BOX BUTTONS OK TITLE "Error processing in the CATCH for mainprocedure block".
END CATCH.
答案1
得分: 2
使用 FIND
函数与 NO-ERROR
。
或者更好的是,在尝试进行任何修改之前,使用 IF AVAIL
,这样只有在找到字段时才尝试更改。
IF AVAIL Customer THEN DO:
// 存在客户
END. ELSE DO:
// 不存在客户 1000
END.
英文:
Use FIND
with NO-ERROR
function.
Or even better yet, use IF AVAIL
before trying to make any modifications, this way it only try to change if it can find the field.
FIND Customer 1000 NO-ERROR.
IF AVAIL Customer THEN DO:
// Customer exists
END. ELSE DO:
// There is no customer 1000
END.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论