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


Groups > comp.lang.javascript > #30616

Re: try ... catch for a specific error ?

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript
Subject Re: try ... catch for a specific error ?
Date 2016-06-02 16:03 +0200
Organization solani.org
Message-ID <nipeap$4db$1@solani.org> (permalink)
References <574fe5c6$0$5901$e4fe514c@news.xs4all.nl> <nip2aa$lvc$1@solani.org> <5750271d$0$5837$e4fe514c@news.xs4all.nl> <nip9et$h5d$1@solani.org> <575036d4$0$5889$e4fe514c@news.xs4all.nl>

Show all headers | View raw


On 02.06.2016 at 15:40, R.Wieser wrote:

>> Most likely for a good reason: this error constant appears to be
>> highly user-agent specific.
> 
> Its not about that specific constant (regard it as an example), but about
> how I compare *any* error-constant to the returned error/exception object.
> Can I check if a specific error has been thrown, and if so how ?

You can apply the usual comparison operators, typeof, instanceof etc.
Note that JavaScript allows objects and scalar values to be thrown.

For your concrete case see JJ's response
(<news:yua8gzzjdwv9$.z2ar9grudtz1$.dlg@40tude.net>).

> As for that constant being rather user-agent specific ?   JavaScript isn't
> only used in webpages. :-)

Indeed, I should have written "host environment specific".

-- 
Christoph M. Becker

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

try ... catch for a specific error ? "R.Wieser" <address@not.available> - 2016-06-02 09:54 +0200
  Re: try ... catch for a specific error ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-02 11:21 +0200
    Re: try ... catch for a specific error ? "R.Wieser" <address@not.available> - 2016-06-02 12:18 +0200
      Re: try ... catch for a specific error ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-02 13:22 +0200
  Re: try ... catch for a specific error ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-02 12:38 +0200
    Re: try ... catch for a specific error ? "R.Wieser" <address@not.available> - 2016-06-02 14:32 +0200
      Re: try ... catch for a specific error ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-02 14:40 +0200
        Re: try ... catch for a specific error ? "R.Wieser" <address@not.available> - 2016-06-02 15:40 +0200
          Re: try ... catch for a specific error ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-02 16:03 +0200
            Re: try ... catch for a specific error ? "R.Wieser" <address@not.available> - 2016-06-02 16:23 +0200
              Re: try ... catch for a specific error ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-02 16:43 +0200
              Re: try ... catch for a specific error ? Tim Streater <timstreater@greenbee.net> - 2016-06-02 20:42 +0100
                Re: try ... catch for a specific error ? Tim Streater <timstreater@greenbee.net> - 2016-06-02 20:44 +0100
      Re: try ... catch for a specific error ? JJ <jj4public@vfemail.net> - 2016-06-02 20:24 +0700
        Re: try ... catch for a specific error ? "R.Wieser" <address@not.available> - 2016-06-02 16:35 +0200
          Re: try ... catch for a specific error ? "R.Wieser" <address@not.available> - 2016-06-03 10:50 +0200
            Re: try ... catch for a specific error ? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-03 17:35 +0200
            Re: try ... catch for a specific error ? "R.Wieser" <address@not.available> - 2016-06-03 22:25 +0200
              Re: try ... catch for a specific error ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-03 23:55 +0200

csiph-web