Page 1 of 1

Error handling

Posted: Thu Mar 08, 2012 5:38 am
by paues
I am trying to catch an error that might occur if the user of the program does not have Macrobond installed. I have modelled the code below on the example given on page 133 in the EViews 7 command reference:

Code: Select all

!max_before=@MaxErrs SetMaxErrs !max_before+1 !err_before=@ErrorCount DbOpen(type=macrobond) macrobond as mb !err_after=@ErrorCount If !err_after>!err_before Then @UiPrompt("Could not open the Macrobond database. The program requires Macrobond to be installed.") Stop EndIf SetErrCount !err_before SetMaxErrs !max_before
But the first line generates an error message: '@MAXERRS is an illegal or reserved name in "!MAX_BEFORE=@MAXERRS" in MyFile.prg'. What am I doing wrong?

Re: Error handling

Posted: Thu Mar 08, 2012 8:53 am
by EViews Gareth
Looks like @maxerrs isn't working at the moment. I'll see if we can fix it.

In the mean time, you could just set the max errors to something arbitrarily high without worrying about what it was before hand.

Re: Error handling

Posted: Thu Mar 08, 2012 8:56 am
by EViews Gareth
Actually, it looks like it is a slight documentation error. The command is @maxerrcount, not @maxerrs. So you can just change your program to use that.

Re: Error handling

Posted: Thu Mar 08, 2012 9:16 am
by paues
Great! Thank you!