Question about TRY ... CATCH ... END

Question about TRY ... CATCH ... END

Postby driessen » 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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about TRY ... CATCH ... END

Postby James Bott » Thu Nov 04, 2010 1:10 pm

Michel,

Maybe something like this:

Code: Select all  Expand view
TRY
...
CATCH oError
  if oError:genCode != ...
     // do whatever
  endif
END


Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Question about TRY ... CATCH ... END

Postby driessen » Thu Nov 04, 2010 1: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about TRY ... CATCH ... END

Postby James Bott » Thu Nov 04, 2010 1:52 pm

xharbour\include\error.ch

EG_ARRACCESS is array access.
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Question about TRY ... CATCH ... END

Postby hag » Thu Nov 04, 2010 2:49 pm

James
Where would you place the code. errsysw.prg???
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Question about TRY ... CATCH ... END

Postby James Bott » Thu Nov 04, 2010 3: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Question about TRY ... CATCH ... END

Postby hag » Thu Nov 04, 2010 3:43 pm

Thanks james
Thank you
Harvey
hag
 
Posts: 598
Joined: Tue Apr 15, 2008 4:51 pm
Location: LOs Angeles, California

Re: Question about TRY ... CATCH ... END

Postby driessen » Thu Nov 04, 2010 4: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about TRY ... CATCH ... END

Postby driessen » Fri Nov 05, 2010 3: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about TRY ... CATCH ... END

Postby James Bott » Fri Nov 05, 2010 5: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Question about TRY ... CATCH ... END

Postby driessen » Fri Nov 05, 2010 5: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about TRY ... CATCH ... END

Postby fraxzi » Sat Nov 06, 2010 7:11 am

Dear Driessen

I do this to examine messages..

Code: Select all  Expand view
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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi, RSalazarU and 82 guests