Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6701845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:58:58+00:00 2026-05-26T06:58:58+00:00

I am calling a function from the console but when it throws an exception

  • 0

I am calling a function from the console but when it throws an exception I do not receive a stack trace like I would if the code was executed normally.

Is there a way I can modify my command (perhaps with try/catch) to have it provide me this information?

to clarify:

page.js:

function otherStuff() { return ['a','b',undefined,'c'];
function doStuff() {
    var x = otherStuff();
    var z = parseInt(x[2]); // this will throw an error
}

console, after loading a html page that links page.js

> otherStuff();

I get no line number from the Error that is returned to me. When running it from the page (instead of the console) i would receive a line number and a stack trace.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:58:58+00:00Added an answer on May 26, 2026 at 6:58 am

    Although verbose, this will print the stack trace of an interactive error in the Chrome JS console:

    try { 
        throw new Error(); 
    } catch (e) { 
        console.error(e.stack); 
    }
    

    Unfortunately this won’t work if a non-Error object is thrown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to return a value from (transport) to the calling function, but can't
Is there anyway to calling a function from another function .. little hard to
So, I am calling a function from an unmanaged .dll file from my C#
I need this for calling a C function from Java class (JNI) and I
I am calling a function in my controller from a button click .... I
When calling functions that always throw from a function returning a value, the compiler
Basically, here's my problem. I'm calling someone else's FORTRAN functions from my C++ code,
I have a few WCF services I am calling from a console app. I
When saving an object by calling Entity.create(:name => Entity1) from the Rails console in
When I run this code: function foo() { console.log(foo); var self = this; this.a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.