FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Question about TRY ... CATCH ... END
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Question about TRY ... CATCH ... END
Posted: Thu Nov 04, 2010 12:36 PM

Hello,

I was just wondering if it is possible to suppress certain errors by using TRY ... CATCH ... END.

What do I mean : is it possible to suppress a certain error (example Bound Array Access) by using TRY ... CATCH ... END ? But if other errors might occur, I do want the error-message.

Thanks a lot in advance

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Question about TRY ... CATCH ... END
Posted: Thu Nov 04, 2010 01:10 PM
Michel,

Maybe something like this:

Code (fw): Select all Collapse
TRY
...
CATCH oError
  if oError:genCode != ...
     // do whatever
  endif
END


Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about TRY ... CATCH ... END
Posted: Thu Nov 04, 2010 01:46 PM

James,

Thanks a lot for your answer.

But can you tell me where I can find a list of the codes oError:GenCode ?

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Question about TRY ... CATCH ... END
Posted: Thu Nov 04, 2010 01:52 PM

xharbour\include\error.ch

EG_ARRACCESS is array access.

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Re: Question about TRY ... CATCH ... END
Posted: Thu Nov 04, 2010 02:49 PM

James
Where would you place the code. errsysw.prg???

Thank you

Harvey
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Question about TRY ... CATCH ... END
Posted: Thu Nov 04, 2010 03:12 PM
Harvey,

Where would you place the code. errsysw.prg???


No, this code goes in your app. It is strategically placed where you want to override errorsys.

Search the forum for "CATCH" to see some examples.

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 598
Joined: Tue Apr 15, 2008 04:51 PM
Re: Question about TRY ... CATCH ... END
Posted: Thu Nov 04, 2010 03:43 PM

Thanks james

Thank you

Harvey
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about TRY ... CATCH ... END
Posted: Thu Nov 04, 2010 04:50 PM

James,

Thanks a lot for your help.

I got it now.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about TRY ... CATCH ... END
Posted: Fri Nov 05, 2010 03:24 PM

James,

Maybe another question about this subject.

I know now how to pick up a certain error by using TRY ... CATCH ... END.

But I want other error-messages to be shown. Is it possible to establish this ?

Thanks a lot in advance.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Question about TRY ... CATCH ... END
Posted: Fri Nov 05, 2010 05:41 PM

Michel,

I'm sure it is possible, but I haven't used TRY/CATCH much and I don't know how. Did you try searching the forum?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about TRY ... CATCH ... END
Posted: Fri Nov 05, 2010 05:43 PM

James,

Thanks a lot for your answer.

No, I didn't search the forum yet. But I will do that and in case I can find an answer, I'll put it here.

Have a nice weekend.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 811
Joined: Tue May 06, 2008 04:28 AM
Re: Question about TRY ... CATCH ... END
Posted: Sat Nov 06, 2010 07:11 AM
Dear Driessen

I do this to examine messages..

Code (fw): Select all Collapse
TRY
...
CATCH oError
  if ValType( oError) == 'O'
     xBrowse( oError )         //this works
  endif
END



Kind Regards,
Frances
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15

Continue the discussion