Error Console links

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error Console links

Robert-212
I have a question about the display of javascript Errors in the Firefox
Error Console.

The Error Console will display the error when a javascript object is
thrown (and not catched).
If this is done with the normal Error object, for example:
throw new Error("my message")
then it shows the error message and a nice link that you can use to jump
to the file and line number
where the Error object was created.

I would like to know what the exact conditions are for this link to be
displayed.
I ask this because I tried to extend the Error object in many ways to
disinguish between different
exceptions, yet still have that useful link in the Error Console.

My custom Exception object is extended in such a way that "instanceof
Error" returns true. And it contains
the fileName and lineNumber properties. Yet I still see no link.

I give some javascript to show you one method I used to extend the Error
object:

************
clone = function (object)
{
     function Dummy(){};
     Dummy.prototype = object;
     return new Dummy();
}

extend = function (superclass, subclass)
{
     subclass.prototype = clone(superclass.prototype);
     subclass.prototype.constructor = subclass;
}

Exception = function(error)
{
     for (var p in error)
     {
         this[p] = error[p];
     }
}
extend(Error, Exception);
Exception.prototype.toString = function()
{
     return "Exception: " + this.message + "
(filename="+this.fileName+":"+this.lineNumber+")";
}

throw new Exception(Error("my exception"));

************

Kind regards,
Robert

_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Error Console links

Justin Wood (Callek)-2
https://developer.mozilla.org/en/Exception_logging_in_JavaScript

On 5/10/2010 6:11 AM, Robert wrote:

> I have a question about the display of javascript Errors in the Firefox
> Error Console.
>
> The Error Console will display the error when a javascript object is
> thrown (and not catched).
> If this is done with the normal Error object, for example:
> throw new Error("my message")
> then it shows the error message and a nice link that you can use to jump
> to the file and line number
> where the Error object was created.
>
> I would like to know what the exact conditions are for this link to be
> displayed.
> I ask this because I tried to extend the Error object in many ways to
> disinguish between different
> exceptions, yet still have that useful link in the Error Console.
>
> My custom Exception object is extended in such a way that "instanceof
> Error" returns true. And it contains
> the fileName and lineNumber properties. Yet I still see no link.
>
> I give some javascript to show you one method I used to extend the Error
> object:
>
> ************
> clone = function (object)
> {
> function Dummy(){};
> Dummy.prototype = object;
> return new Dummy();
> }
>
> extend = function (superclass, subclass)
> {
> subclass.prototype = clone(superclass.prototype);
> subclass.prototype.constructor = subclass;
> }
>
> Exception = function(error)
> {
> for (var p in error)
> {
> this[p] = error[p];
> }
> }
> extend(Error, Exception);
> Exception.prototype.toString = function()
> {
> return "Exception: " + this.message + "
> (filename="+this.fileName+":"+this.lineNumber+")";
> }
>
> throw new Exception(Error("my exception"));
>
> ************
>
> Kind regards,
> Robert
>

_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Error Console links

Justin Wood (Callek)-2
On 5/19/2010 1:18 AM, Justin Wood (Callek) wrote:
> https://developer.mozilla.org/en/Exception_logging_in_JavaScript
>

also: https://developer.mozilla.org/en/nsIScriptError


> On 5/10/2010 6:11 AM, Robert wrote:
>> I have a question about the display of javascript Errors in the Firefox
>> Error Console.
>>
>> The Error Console will display the error when a javascript object is
>> thrown (and not catched).
>> If this is done with the normal Error object, for example:
>> throw new Error("my message")
>> then it shows the error message and a nice link that you can use to jump
>> to the file and line number
>> where the Error object was created.
>>
>> I would like to know what the exact conditions are for this link to be
>> displayed.
>> I ask this because I tried to extend the Error object in many ways to
>> disinguish between different
>> exceptions, yet still have that useful link in the Error Console.
>>
>> My custom Exception object is extended in such a way that "instanceof
>> Error" returns true. And it contains
>> the fileName and lineNumber properties. Yet I still see no link.
>>
>> I give some javascript to show you one method I used to extend the Error
>> object:
>>
>> ************
>> clone = function (object)
>> {
>> function Dummy(){};
>> Dummy.prototype = object;
>> return new Dummy();
>> }
>>
>> extend = function (superclass, subclass)
>> {
>> subclass.prototype = clone(superclass.prototype);
>> subclass.prototype.constructor = subclass;
>> }
>>
>> Exception = function(error)
>> {
>> for (var p in error)
>> {
>> this[p] = error[p];
>> }
>> }
>> extend(Error, Exception);
>> Exception.prototype.toString = function()
>> {
>> return "Exception: " + this.message + "
>> (filename="+this.fileName+":"+this.lineNumber+")";
>> }
>>
>> throw new Exception(Error("my exception"));
>>
>> ************
>>
>> Kind regards,
>> Robert
>>
>

_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger