How can I get the string/message or code from a video tag error event?

So this feels like a stupid question. Hopefully I'm just overlooking something obvious, but I am listening for an error on a video element. The error string actually shows in the console, and the error event fires properly, but when I look through the error object, I can't seem to find that string anywhere. My goal is to simply record this error for logging purposes. Another option is to get the error code -- anything really that could be logged to give our debuggers a clue as to what the problem actually was. Any idea how to get the error string or code from a video tag error object?

code:

$(this.video)
    .on( 'error', this.proxy(this.onVideoError));

onVideoError : function(e) {
  console.log(e, " the e");
  console.log(e.toString());//prints [object Object]
  console.log(e.code, " the code");// prints undefined
},

Answers


In my error handlers I am using the err.name and err.message members. Since errors don't actually have a Code like in PHP or other languages, you might need to parse the message and name to create your own Codes.

var errorHandler = function(err) {

  // prints the name of the error
  console.log(err.name);

  // prints the description that is also shown in the error console
  console.log(err.message);

  // this works only in some browsers
  // line and stack are not supported by all vendors
  console.log(err.line, err.stack);
}

Need Your Help

Text summarization in R language

r text text-mining summarization

I have long text file using help of R language I want to summarize text in at least 10 to 20 line or in small sentences.

Capture SeekBar values

android seekbar

In my android application I have a TextView and a SeekBar. Both the values are used for calculating result on a button click.