1. Daniel Vivier
  2. PowerBuilder
  3. Tuesday, 28 March 2017 16:54 PM UTC

I'm using dw.Describe("Evaluate('...', 0)") with a complex DW expression in the ... part. I'm OK with the fact that this may fail for some expressions, but my concern is that when it fails, I get a message box with the title "Data Entry Error" and contents "Expression is not valid". I don't want the users to see that! I tried catching it with try/catch, using the most generic catchable data type (Throwable) but it doesn't get caught - the message box still comes up.

Is there a solution to this? Thanks.

 

Accepted Answer
Mike S Accepted Answer Pending Moderation
  1. Tuesday, 28 March 2017 17:22 PM UTC
  2. PowerBuilder
  3. # Permalink

dw.Modify("DataWindow.NoUserPrompt=yes")

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 29 March 2017 14:21 PM UTC
  2. PowerBuilder
  3. # 1

You could try overriding the Describe function in your base DataWindow object. You can then add whatever error handling you want, including throwing an exception.

Comment
  1. Olan Knight
  2. Tuesday, 11 April 2017 01:43 AM UTC






What I have done is to create a boolean public variable in corp_u_dw named

1)               boolean          ib_msg_already_displayed





2) itemerror event  --- at the bottom of the event:



     // O Knight, 14-APR-2004.

     IF (ib_msg_already_displayed) THEN RETURN SUCCESS



3) dberror event - at the top of the event:

     // O Knight, 14-APR-2004.        Do not display the database error msg if the

     //                                                descendant has already displayed an error msg.

     IF (ib_msg_already_displayed) THEN GOTO Exit_Script    



   // At the end of the script:

     Exit_Script:

         ib_msg_already_displayed = FALSE

         RETURN 1



4) of_errormsg()    --- set at the end of the function

     // O Knight, 14-APR-2004.

     ib_msg_already_displayed = TRUE



5) In the descendant code, I can choose to display an error message of my own design, then set the flag to TRUE. That way none of the PB-generated error messages will be displayed.



Olan







  1. Helpful
There are no comments made yet.
Yakov Werde Accepted Answer Pending Moderation
  1. Tuesday, 28 March 2017 19:32 PM UTC
  2. PowerBuilder
  3. # 2

Hi Dan,

Two reasons: 1) Describe is classic PB code and 2) it's DataWindow Engine generated

PS Very few native PowerScript functions were altered to throw exceptions

Mostly runtimeerrors were shoehorned in to allow you to keep them from escalating

Comment
There are no comments made yet.
Daniel Vivier Accepted Answer Pending Moderation
  1. Tuesday, 28 March 2017 18:11 PM UTC
  2. PowerBuilder
  3. # 3

Perfect, Mike, thank you! I still don't understand why that shouldn't be catchable with try/catch though.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.