|
Pak Hermawan,
Bisa pakai TRY-CATCH
========================
SystemError PowerScript event
Description
Occurs when a serious execution time error occurs (such as trying to open a nonexistent window) if the error is not handled in a TRY-CATCH block.
Event ID
Event ID Objects None Application Arguments
None
Return value
None (do not use a RETURN statement)
Usage
If there is no script for the SystemError event, PowerBuilder displays a message box with the PowerBuilder error number and error message text. For information about error messages, see the PowerBuilder User's Guide. You can prevent the SystemError event from occuring by handling errors in TRY-CATCH blocks. Well-designed exception-handling code gives application users a better chance to recover from error conditions and run the application without interruption.
For information about exception handling, see Application Techniques. Previously, for errors involving external objects and DataWindows, you could handle the error in the ExternalException or Error events and prevent the SystemError event from occurring. The ExternalException and Error events are maintained for backward compatibily only. When a SystemError event occurs, your current script terminates and your system may become unstable. It is generally not a good idea to continue running the application, but you can use the SystemError event script to clean up and disconnect from the DBMS before closing the application.
Salam,
Afri >>> Hermawan Dephe < [email protected]> 6/10/2011 2:21 PM >>>
Yup.. di PB beberapa error emang udah disediain handlenya misal di transaction SQLCA, datawindow, dll
td nyoba bikin Function yang manggil object MSComm bwt ngecek port modem yg aktif.. masalahnya.. untuk tau aktif atau tidaknya suatu port, cara ngeceknya adalah dengan error/tidak saat koneksi dengan MSComm tadi.. kalo saat di set MSComm.PortOpen = True -> Sukses berarti port aktif, jika saat di set MSComm.PortOpen = True -> Error berarti port tidak aktif...
masalahnya.. kalo di PB begitu nemu error langsung muncul "PowerBuilder Application Execution Error"
berikut kalo script di VB ------------------------------------------
On Error GoTo EHIsModem Dim t As Double Dim s As String
IsModem = False If c.PortOpen Then c.PortOpen = False c.CommPort = p c.PortOpen = True 'if port doesn't exist, an error will take us to the exit... ... EHIsModem: End Function
---------------------------------
Donny Irsandi wrote:
klo di pb on error langsung masuk ke event, misal: systemerror, dberror atau other (event other ga disaranin diisi script) coba lihat contoh di PFC gimana cara ngatur error deh
On Fri, Jun 10, 2011 at 9:53 AM, hotdin gurning <[email protected]> wrote:
Kalo GOTO yang di PB itu sebenarnya label, sama kayak di pascal. Jadi saya pikir, bukan utk error handle.
Pak DP ada contoh kasus kah?biar lebih jelas.. soalnya susah ngebandingin VB sama PB.
Dari: Djoko Prasetiyo <[email protected]> Kepada: "[email protected]" <[email protected]> Dikirim: Jumat, 10 Juni 2011 9:41 Judul: RE: [indopb] Error Handle di PB
Ada, dan bias pakai GOTO…. Di PB
Aku pernah coba,…
Udh cb pake try-catch!
Powered by Telkomsel BlackBerry®
Date: Fri, 10 Jun 2011 08:50:46 +0700
Subject: [indopb] Error Handle di PB
Kalo di VB kan ada tuh ya ON ERROR RESUME NEXT ON ERROR GOTO ...
Kalo di PB ada ga ya??
***** This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. PT Pertamina (Persero) is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. *****
|