#744 ✓ staged
Scott Downe

log Popcorn.errors to console without stopping the experience

Reported by Scott Downe | September 29th, 2011 @ 12:18 PM | in 0.9 (closed)

With the try catch stuff being landed, I am concerned with new plugin devs not knowing to check Popcorn.errors to find errors during the development process.

I noticed we have Popcorn.plugin.debug. Maybe the solution is to show errors to console if this is true. Maybe the solution is to find a way to show them without stopping the experience.

I don't know the solution yet, but I want it to be obvious for new plugin devs that they have something as simple as a syntax error.

For the record, I don't much like debug modes. It's a gotch-ya moment for something as simple as a syntax error.

Showing errors without stopping the experience would be ideal.

Crazy idea... What if we fired start, end, _setup inside of a setTimeout( 0, function ); this way, it fails on a "thread", error is shown, but if I am correct, the experience will keep running.

Comments and changes to this ticket

  • cadecairos

    cadecairos September 29th, 2011 @ 12:36 PM

    I appreciate the idea of having the timeUpdate loop not failing because of bad plugin code. My opinion still stands from #719 that we should really make it a Plug-in "best practices" issue, in that if someone writes a plug-in that can potentially throw and stop the threads execution, they should have the foresight to catch it. The fix from 719 isn't necessarily wrong, it is bad news for new plug-in developers.

    If I were new to popcorn and was writing a plug-in, I could have a syntax error and not see anything in the error console, because every throw is being directed to Popcorn.plugin.errors. I could spend ages trying to figure out that it even exists, lose interest and drop Popcorn altogether.

    Scott has an interesting idea with the timeout, but it seems too hacky for production code, so I can't really back it. I really just think this should be a best practices thing for the documentation. This may leave us on the hook for plug-ins we officially support, but it stops the encouragement of buggy code from being written by plug-in authors.

  • David Seifried

    David Seifried September 29th, 2011 @ 12:41 PM

    Yea scott and I spent a good bit of time this morning talking about this and I agree that we need to be showing the errors to the devs. I know that if I was developing and something wasn't working and I was getting no errors in console, I would get frustrated pretty quick and wonder what is going on. It seems like finding Popcorn.plugin.errors is just to explain why this is happening will probably involve a dev wasting a good amount of time to find it in our docs.

    I tried out what scott suggested with the setTimeout hack and it works pretty good. We get our normal errors and still continue popcorn along its normal path. Another idea might be just to log it as soon as an error is caught, so at least a dev has some way to see what has happened immediately.

    Im on board with Scott with this one in the fact that we may have jumped the gun on throwing this into core.

  • Rick

    Rick September 29th, 2011 @ 01:37 PM

    I like the idea of using Popcorn.plugin.debug = true as a flag to dump errors to the console

  • David Seifried

    David Seifried September 29th, 2011 @ 01:40 PM

    Yea we were discussing this some more and we could turn it on by default, and leave it to the developer to turn it off when they want to suppress errors.

  • Scott Downe

    Scott Downe September 29th, 2011 @ 02:21 PM

    Yeah, Popcorn.plugin.debug = true is looking like a viable option.

    Setting it to true is still a gotch-ya moment.

    What if we called it the inverse of debug, something like Popcorn.plugin.errors.suppress, had it false by default. Then, any errors thrown by try catch, with suppress being false, would add something like "error caught inside a plugin, to suppress, use Popcorn.errors.surpress"

    The idea is, you get an "it just works" workflow. Nothing is hidden by default.

  • cadecairos

    cadecairos September 29th, 2011 @ 02:25 PM

    I can agree with an approach like that

  • Scott Downe

    Scott Downe September 29th, 2011 @ 02:27 PM

    I dunno, maybe I am beating a dead horse here. But I don't want new users to fall into the hole of not knowing why their plugin is doing nothing, and not knowing to check or set a flag on Popcorn.

    I see the use case of a bug in a plugin during development being much higher than a rogue plugin slipping into an app.

  • David Seifried

    David Seifried September 29th, 2011 @ 03:22 PM

    This is actually causing the facebook plugin test to fail because we are attempting to catch errors being thrown, and since they are no longer being thrown, the tests are not passing anymore. Im definitely for taking this out of the core for now.

  • Scott Downe

    Scott Downe September 29th, 2011 @ 03:26 PM

    For now let's at least have debug = true not suppress the errors.

  • Scott Downe

    Scott Downe September 29th, 2011 @ 03:29 PM

    • State changed from “new” to “assigned”
    • Assigned user set to “cadecairos”
  • cadecairos

    cadecairos September 29th, 2011 @ 04:57 PM

    • State changed from “assigned” to “peer-review-requested”
    • Assigned user changed from “cadecairos” to “David Seifried”
  • David Seifried

    David Seifried September 29th, 2011 @ 05:36 PM

    • State changed from “peer-review-requested” to “super-review-requested”
    • Assigned user changed from “David Seifried” to “Rick”

    This looks good to me, passes lint, tested in FF 7 and Chrome 14.

    PR+

  • Rick

    Rick September 30th, 2011 @ 11:42 AM

    • State changed from “super-review-requested” to “review-looks-good”
    • Assigned user changed from “Rick” to “cadecairos”

    SR+

    Tested: core test suite;

    Passing in:

    • FF 3.6 (stable), 7.x (stable)

    • Chrome 14 (Stable), 15 (Beta)

    Lint Passes

  • cadecairos

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Popcorn.js is an HTML5 video framework that lets you bring elements of the web into your videos.

Popcorn.js is a project of Web Made Movies, Mozilla's Open Video Lab.

Shared Ticket Bins

Referenced by

Pages