Firefox Error Console links

Discussion in 'Javascript' started by Robert, May 10, 2010.

  1. Robert

    Robert Guest

    I have a question about the display of javascript Errors in the Firefox
    Error Console. Maybe not completely on-topic, but I hope someone here
    might know the answer.

    The Error Console will display an 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
    distinguish 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
     
    Robert, May 10, 2010
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Natwick
    Replies:
    3
    Views:
    18,615
    bruce barker
    Mar 1, 2005
  2. Jon Natwick
    Replies:
    0
    Views:
    661
    Jon Natwick
    Mar 1, 2005
  3. Ben Finney
    Replies:
    2
    Views:
    1,213
    Egor Bolonev
    Jun 30, 2003
  4. Mickey Segal

    Firefox 2.0.0.1 trashes Java Console

    Mickey Segal, Dec 20, 2006, in forum: Java
    Replies:
    17
    Views:
    1,048
    Mickey Segal
    Dec 23, 2006
  5. Miktor
    Replies:
    7
    Views:
    12,700
    Joe Bacigalupa
    Aug 9, 2005
  6. Replies:
    5
    Views:
    3,740
    James Kanze
    Mar 4, 2008
  7. Kris Rudin

    console app w/o seeing console?

    Kris Rudin, Nov 11, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    294
    Randy Charles Morin
    Nov 11, 2003
  8. RezaRob

    firefox Error Console line numbers?

    RezaRob, Jun 26, 2007, in forum: Javascript
    Replies:
    2
    Views:
    237
    RezaRob
    Jun 26, 2007
Loading...