Title: TRY/END TRY Post by: Tim B. on March 25, 2011, 10:36:42 am We have made extensive use of this in our project, but the side effect is that error messages are not suppressed and still go to the log. We could redirect these in every statement with STARTLOG, but it's not really ideal.
Is there any other way of doing it, or could something like a profile directive be added in the future? Title: Re: TRY/END TRY Post by: Reuben B. on March 29, 2011, 12:18:06 am To avoid messages going to the ERRORLOG, use WHENEVER ANY ERROR CONTINUE https://4js.com/online_documentation/fjs-fgl-manual-html/User/Exceptions.html#TRACE, unfortunately that doesn't help you as TRY is effectively a WHENEVER ANY ERROR GOTO https://4js.com/online_documentation/fjs-fgl-manual-html/User/Exceptions.html#TRYCATCH
I'm guessing you are using TRY so that ... Code
... is the equivalent of ... Code
... and as you've discovered, the TRY will write messages to the ERRORLOG whilst WHENEVER ANY ERROR CONTINUE doesn't. Personally I'd like to see CATCH be able to trap certain exceptions ... Code
... so that I can handle the error I have anticipated, and let the normal error handler deal with unexpected errors. Certainly in that case I wouldn't want the error I have anticipated and dealt with to appear in the errorlog, but I would want the unanticipated error to be in the errorlog. For now, you could get clever with the pre-processor and do something like ... Code
Reuben Title: Re: TRY/END TRY Post by: Sebastien F. on March 29, 2011, 10:28:30 am Hello,
I would avoid to use the preprocessor until there is no other way to solve a blocking problem or missing language instruction. So I would not use preprocessor macros for this issue, having additional records in the log is not that critical. You get the line number in the source so you know if comes from a TRY/CATCH block and can be ignored. But I agree it can be annoying. I will talk with the team to see what we can do. Seb Title: Re: TRY/END TRY Post by: Tim B. on March 29, 2011, 05:01:52 pm Thanks for the responses. The errors in the log are not critical, but we keep a close eye on them, and there are now so many errors it's difficult to find the real ones amongst all the rest.
We're using TRY for a number of different things, but mostly to check that DELETEs are either successful, or fail due to referencial integrity issues (which saves a lot of checking). Being able to catch specific exceptions which you are expecting (and avoid the error logging) would be a very good enhancement. Title: Re: TRY/END TRY Post by: Tim B. on July 12, 2011, 11:57:08 am Has there been an further thoughts on this one al all?
Title: Re: TRY/END TRY Post by: Sebastien F. on July 12, 2011, 12:40:57 pm Hello,
The topic is registered in our bug database with id #20606 Seb |