[Gambas-user] Behaviour FINALLY CATCH

Gianluigi bagonergi at gmail.com
Sun Apr 1 22:22:12 CEST 2018


Here work well
------------------------------------------
' Gambas module file


Public Sub Main()

  fncCheckDigit1() 'row 6
  fncCheckDigit2() 'row 7

End


Public Function fncCheckDigit1() As Integer

  Dim intZahl, intWert As Integer
  Dim strError As String

  intZahl = intWert / 0 'row 17

  Finally                     ' Aufräumen nach Fehler
  'Blah blah blubb
  Print "Pippo"
Catch                       ' Fehlerbahndlung
  For Each strError In Error.Backtrace
    Debug strError & gb.NewLine 'row 24
  Next

End

'This will work:

Public Function fncCheckDigit2() As Integer

  Dim intZahl, intWert As Integer
  Dim strError As String

  intZahl = intWert / 0 'row 36

  Finally                     ' Aufräumen nach Fehler
  Print "Pluto"
Catch                       ' Fehlerbahndlung
  For Each strError In Error.Backtrace
    Debug strError & gb.NewLine 'row 42
  Next

End
---------------------------------------------
Output in console:
---------------------------------------------
Pippo
Main.fncCheckDigit1.24: Main.fncCheckDigit1.17

Main.fncCheckDigit1.24: Main.Main.6

Pluto
Main.fncCheckDigit2.42: Main.fncCheckDigit2.36

Main.fncCheckDigit2.42: Main.Main.7
----------------------------------------------
Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180401/35532f38/attachment-0001.html>


More information about the User mailing list