Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 91c5b391e9
Fetching contributors…

Cannot retrieve contributors at this time

62 lines (44 sloc) 1.666 kB
title
Popcorn.plugin.errors

Popcorn.plugin.errors

Purpose

Popcorn.plugin.errors is an array object that contains errors thrown from plugins when Popcorn is not in debug mode. Each error object in Popcorn.plugin.errors will look like: {% highlight js %} { plugin: pluginName, thrown: originalErrorObject, source: pluginFunction-toString } {% endhighlight %}

Options

  • Popcorn.plugin.errors [Array Object] - Stores suppressed errors from plugins

Use Case

  • Inspection of this object can help a developer solve problems with their Popcorn projects.
  • The redirection of errors to Popcorn.plugin.errors makes sure that execution of the entire project continues even in the case of a single plugin failing during runtime.

Examples

{% highlight js linenos %} // Debug mode is off by default

// Create a plugin that will throw an error when it's start function runs
Popcorn.plugin( "foo", {
  start: function() {
    throw new Error();
  }
});

// Create Popcorn instance
var pop = Popcorn( "#video-element-id" );

// set up "foo" event
pop.foo({ start: 1 });

// The error will be caught by Popcorn.plugin.errors
pop.listen( "error", function( e ) {
  // 'e' is Popcorn.plugin.errors, which can be accessed outside the "error" event callback.
  console.log( e );
});

pop.play();

{% endhighlight %}

Related

Jump to Line
Something went wrong with that request. Please try again.