<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>26159</bug_id>
          
          <creation_ts>2014-06-21 08:11:38 +0000</creation_ts>
          <short_desc>request: caller&apos;s line number, filename, function name to assist in debugging</short_desc>
          <delta_ts>2014-06-21 12:54:52 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>JavaScript</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jim Michaels">jmichae3</reporter>
          <assigned_to name="Mathias Bynens">mathias</assigned_to>
          <cc>mike</cc>
          
          <qa_contact>sideshowbarker+javascript</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>108155</commentid>
    <comment_count>0</comment_count>
    <who name="Jim Michaels">jmichae3</who>
    <bug_when>2014-06-21 08:11:38 +0000</bug_when>
    <thetext>it would be nice if somehow js could let me know what line number and file from the caller caused the problem. it would make my debugging tremendously easier.
I think it would help a lot of people who develop web pages. something like this could be a predefined variable of some kind.
thanks.

this could mean examining the previous item on the call stack I suppose.

the idea is that, within the function call, I could maybe have access to the caller&apos;s function name, filename, and line number within the called function somehow.

as things are now, some debugger messages are pretty incomprehensible. I get messages about scripts I did not include on my site, and error messages I don&apos;t understand because they are specific to some package somewhere (and not documented well).

having these 3 pieces of information allows them, and me, to write my libraries in a way that helps the web programmer/designer fix problems without head scratching, they can get the error message form the console.log with the offending line# from the specific file they wrote, and jump right to it and fix the problem.

it&apos;s a time saver.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108156</commentid>
    <comment_count>1</comment_count>
    <who name="Jim Michaels">jmichae3</who>
    <bug_when>2014-06-21 08:12:05 +0000</bug_when>
    <thetext>change to enhancement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108161</commentid>
    <comment_count>2</comment_count>
    <who name="Jim Michaels">jmichae3</who>
    <bug_when>2014-06-21 08:31:03 +0000</bug_when>
    <thetext>RE: comment 1 where it says 

&quot;the idea is that, within the function call, I could maybe have access to the caller&apos;s function name, filename, and line number within the called function somehow.&quot; 

could be rewritten more clearly as 

&quot;the idea is that, within the callee (the function called), I could have access to the caller&apos;s function name, filename, and line number within the called function somehow.&quot;

example: let&apos;s say in my file abc.html I am using the library xyz.js
&lt;script src=&quot;/xyz.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
var x=xyz(&quot;123&quot;,5);
&lt;/script&gt;

within xyz(), it could console.log() line 20 in file abc.html (or some other case may be that something is being called within a js file) and the calling function is an empty string since there is no parent.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108180</commentid>
    <comment_count>3</comment_count>
    <who name="Mathias Bynens">mathias</who>
    <bug_when>2014-06-21 12:54:52 +0000</bug_when>
    <thetext>This is outside the scope of the JavaScript / Web ECMAScript spec. See &lt;http://javascript.spec.whatwg.org/#goals&gt;.

To propose new features to the ECMAScript language, please file a bug on https://bugs.ecmascript.org/.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>