Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11950

Re: Is there a way to check the state of the error handler?

Newsgroups microsoft.public.scripting.vbscript
Subject Re: Is there a way to check the state of the error handler?
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References (3 earlier) <pdh1v1$qe1$1@gioia.aioe.org> <pdh8ia$8kl$1@dont-email.me> <pdhj6l$1pka$1@gioia.aioe.org> <16hup5czgwt9h$.qrovq8sry17m.dlg@40tude.net> <pdn4n1$tir$1@gioia.aioe.org>
Date 2018-05-18 23:27 +0200
Message-ID <XnsA8E6EEB45F602eejj99@194.109.6.166> (permalink)

Show all headers | View raw


"R.Wieser" <address@not.available> wrote on 18 May 2018 in
microsoft.public.scripting.vbscript: 

> JJ,
> 
>> I always save `Err.Number` into a variable, before executing
>> `on error goto 0` - because after `on error goto 0`, `Err.Number`
>> is cleared.
> 
> Yup, exactly that.   A waste of a good variable, don't you think ? (also
> you than have just one of the helpful-when-debugging attributes saved. 
> The error object has a few others.
> 
>> But logically (or systematically), shouldn't `on error goto 0` not
>> clear `Err.Number`?
> 
> Thats what I tried to say. :-)
> 
> Also, outside of an "catch the error" block the error object seems to be
> rather unuseful: The system than catches it and aborts the script,
> before you are able to access the error object.

Well, you can test any number of statements
after a single 'on error resume next'
and outut or store the Err.Number.

If you do not do an Err.Clear,
the Err.Number will only be overwritten on a new error,
while correct statements would not reset the Err.Number.

on error resume next

q = 8 / 0
ErrNumber1 = Err.Number '' 11

Err.Clear
qwerty
ErrNumber2 = Err.Number '' 13

'''Err.Clear
q = 8 / 1
ErrNumber3 = Err.Number '' 13

Err.Clear
q = 8 / 2
ErrNumber4 = Err.Number '' 0

Here ErrNumber3 would carry the error of the querty statement,
so 'q = 8 / 1' might be construed as being erroneous.








-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is there a way to check the state of the error handler? JJ <jj4public@vfemail.net> - 2018-05-15 13:04 +0700
  Re: Is there a way to check the state of the error handler? "Auric__" <not.my.real@email.address> - 2018-05-15 06:55 +0000
    Re: Is there a way to check the state of the error handler? JJ <jj4public@vfemail.net> - 2018-05-15 22:10 +0700
  Re: Is there a way to check the state of the error handler? "Mayayana" <mayayana@invalid.nospam> - 2018-05-15 09:14 -0400
    Re: Is there a way to check the state of the error handler? JJ <jj4public@vfemail.net> - 2018-05-15 22:22 +0700
      Re: Is there a way to check the state of the error handler? "Mayayana" <mayayana@invalid.nospam> - 2018-05-15 11:53 -0400
  Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-15 17:26 +0200
    Re: Is there a way to check the state of the error handler? JJ <jj4public@vfemail.net> - 2018-05-16 16:52 +0700
      Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-16 12:42 +0200
        Re: Is there a way to check the state of the error handler? "Mayayana" <mayayana@invalid.nospam> - 2018-05-16 08:34 -0400
          Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-16 17:36 +0200
            Re: Is there a way to check the state of the error handler? JJ <jj4public@vfemail.net> - 2018-05-19 00:03 +0700
              Re: Is there a way to check the state of the error handler? "Mayayana" <mayayana@invalid.nospam> - 2018-05-18 13:18 -0400
                Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-18 20:15 +0200
                Re: Is there a way to check the state of the error handler? "Mayayana" <mayayana@invalid.nospam> - 2018-05-18 15:12 -0400
                Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-19 11:23 +0200
                Re: Is there a way to check the state of the error handler? "Mayayana" <mayayana@invalid.nospam> - 2018-05-19 10:28 -0400
                Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-19 22:19 +0200
              Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-18 20:06 +0200
                Re: Is there a way to check the state of the error handler? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-05-18 23:27 +0200
                Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-19 12:15 +0200
                Re: Is there a way to check the state of the error handler? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-05-19 21:30 +0200
                Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-19 22:21 +0200
                Re: Is there a way to check the state of the error handler? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-05-19 22:32 +0200
                Re: Is there a way to check the state of the error handler? "R.Wieser" <address@not.available> - 2018-05-20 11:06 +0200
                Re: Is there a way to check the state of the error handler? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-05-20 12:09 +0200

csiph-web