Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #22480
| Message-ID | <2810704.ZYsuzNNPX5@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2013-12-29 20:31 +0100 |
| Subject | Re: Insert Function into Error Object |
| Newsgroups | comp.lang.javascript |
| References | <e799$52bb95fb$adbbaaad$21889@ALLTEL.NET> <d539b$52befa47$adb8eda9$1902@ALLTEL.NET> <l9ps7t$doa$1@dont-email.me> |
Cezary Tomczyk wrote:
> 2013-12-28 17:20, MC wrote:
> [...]
>> So no one has any ideas on how to attach a function to be called when
>> the Error object is called?
>
> Take a look at:
> http://stackoverflow.com/questions/783818/how-do-i-create-a-custom-error-in-javascript
The accepted answer is wrong as explained many times, not least in
<http://stackoverflow.com/a/12593269/855543>
The correct approach is
NotImplementedError.prototype = (function () {
function Foo () {}
Foo.prototype = Error.prototype;
return new Foo;
}());
or simply
NotImplementedError.prototype = Object.create(Error.prototype, {
…
});
See also JSX:object.js.
--
PointedEars
Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Insert Function into Error Object MC <news@aisus.com> - 2013-12-25 20:48 -0600
Re: Insert Function into Error Object Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-26 18:46 -0200
Re: Insert Function into Error Object MC <news@aisus.com> - 2013-12-26 18:47 -0600
Re: Insert Function into Error Object "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-27 09:54 +0100
Re: Insert Function into Error Object MC <news@aisus.com> - 2013-12-27 10:16 -0600
Re: Insert Function into Error Object MC <news@aisus.com> - 2013-12-27 10:26 -0600
Re: Insert Function into Error Object JJ <duh@nah.meh> - 2013-12-28 00:53 +0700
Re: Insert Function into Error Object "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-12-26 20:17 -0800
Re: Insert Function into Error Object Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2013-12-27 11:15 -0200
Re: Insert Function into Error Object MC <news@aisus.com> - 2013-12-27 10:09 -0600
Re: Insert Function into Error Object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-27 17:24 +0100
Re: Insert Function into Error Object MC <news@aisus.com> - 2013-12-27 10:34 -0600
Re: Insert Function into Error Object "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-12-27 17:57 +0100
Re: Insert Function into Error Object MC <news@aisus.com> - 2013-12-28 10:20 -0600
Re: Insert Function into Error Object JJ <duh@nah.meh> - 2013-12-29 07:12 +0700
Re: Insert Function into Error Object Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-12-29 20:13 +0100
Re: Insert Function into Error Object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-29 20:31 +0100
Re: Insert Function into Error Object MC <news@aisus.com> - 2014-01-12 11:26 -0600
Re: Insert Function into Error Object "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-01-13 02:59 -0800
Re: Insert Function into Error Object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-13 12:59 +0100
Re: Insert Function into Error Object "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-01-13 04:37 -0800
csiph-web