Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am trying to hide an Adobe Ole Control error from the user using a nested Try/Catch.

Status
Not open for further replies.

CFauvel2

Programmer
Jul 27, 2024
2
US
Powerbuilder 11.5 and latest Adobe Reader

It is a window with the an Adobe reader OLE control in it,

I have the following code to try to
1 - not crash the powerbuilder app
2 - hide from the user the scary error message.


TRY
ole_1.object.src_ = is_local_pdf_copy_filepath //the SRC is purposely misspelled to throw an error
CATCH (Throwable the_exception)

string ls_test
ls_test = the_exception.text

TRY

ole_1.object.loadfile_(is_local_pdf_copy_filepath) //the LoadFile is purposely misspelled to throw an error
CATCH (Throwable the_exception2)
ls_test = ls_test + '~r~n' + the_exception2.text

MessageBox('Claim Processing','A problem occurred trying to load the pdf within ADOBE reader. You are not going to be able to prelog this claim. ')

String ls_message
ls_message = 'A problem occurred trying to load the pdf within ADOBE reader. neither the Loadfile or .SRC call worked. ' + '~r~n' +ls_test
this.event ue_send_email_pdf( the_exception2,ls_message)

Close(this)
RETURN
END TRY

END TRY

The try/catch is working in that it doesn't crash the app...but I get an error message on the first call...the second call fails silently like I want

Any ideas how to get the first call to fail silently ?

OleRunTimeError_Adobe_bhtk1i.png
 
UPDATE - I do NOT know why but adding a IF statement to the calls has given me the desired results


if upper(sqlca.servername) = 'XXXXXX' then
ole_1.object.src_ = is_local_pdf_copy_filepath //in DEV it lands here as intended and the errors are silent and caught
ELSE
ole_1.object.src = is_local_pdf_copy_filepath
END IF

UPDATE2: I added an AND looking for a particular person's login account and the first bad call bubbled up again. (the screen shot)
But when I built the app and deployed it into a dev area (exe and PBDs) the popup message didn't popup (as desired) ....must be something about Running the app within the IDE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top