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 6345269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:47:26+00:00 2026-05-24T20:47:26+00:00

I have been experimenting with supplying better debugging information when an error happens in

  • 0

I have been experimenting with supplying better debugging information when an error happens in asynchronous code in AS3.

As an example of the poor error reporting be default, take the case where I force a null pointer in a Timer callback (github gist), I get the following stacktrace back on the console:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Function/<anonymous>()[/[path-to-source-file]/TestClass.as:14]
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

This tells me very little about how the timer callback actually links to my code.

The question is: How can I get information about what code created the callback?

I have added one of my solutions below. I’m interested to see if this can be improved.

  • 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-24T20:47:27+00:00Added an answer on May 24, 2026 at 8:47 pm

    One possible solution is to pre-create an Error object in the consumer “thread”/”scope”

            var errorInConsumerScope:Error = new Error()
    
            var timer:Timer = new Timer(1000, 1)
            timer.addEventListener(TimerEvent.TIMER, internalCallback)
            timer.start()
    
            function internalCallback(e:TimerEvent):void 
            {
                try
                {
                    // do something that could cause an error
                }
                catch (e:Error)
                {
                    errorInConsumerScope.message = e.message
                    throw errorInConsumerScope
                }
            }
    

    This now gives me the stacktrace back into my calling code:

    Error: Error #1009: Cannot access a property or method of a null object reference.
        at TestClass()[/[path-to-source-file]/TestClass.as:10]
        at Main()[/[path-to-source-file]/Main.as:9]
    

    The complete gist is here

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

Sidebar

Related Questions

I have been experimenting with woopra.com A web analytics tool. Which requires a piece
I have been experimenting with WPF and rendering strict XAML markup in a web
I have been experimenting with Lambda expressions in Oxygene. Very simple recursive lambda expression
I have been experimenting with a lot of web development apps like Drupal, Moodle,
I have been experimenting with writing applications that use a local SQL Database to
I have been experimenting with sending messages from two .NET Windows Forms applications using
I have been experimenting with TMask in Delphi 2010 and it seems to work
I'm working on building a tree structure in MySQL and have been experimenting with
What is the best compiler to experiment with C++0x features? I have been experimenting
I have been experimenting with PulpCore, trying to create my own tower defence game

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.