如何抑制来自其他过程的错误消息? – PROGRESS 4GL

huangapple go评论49阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年4月17日 19:12:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76034529.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定