Since: DataTables 1.10

Set how DataTables will report detected errors.


If DataTables encounters an error that it "knows about" (invalid JSON for example), it can provide useful information that describes the error and how to address it.

The default error handling is intentionally obtrusive to let developers know that there is an issue while they are writing code that interfaces with DataTables. However, this is not always what you might wish to have on your page and this static option provides the ability to control how errors are reported.




Perform one of the built in error reporting actions:

  • alert (default) - Alert the error
  • throw - Throw a Javascript error
  • none - Do nothing (you would want to use this error in this case)

function $.fn.dataTable.ext.errMode( settings, techNote, message )


As a function you may provide your own error handling, for example showing a message to the end user or reloading the page to recover from an error situation.


No return is excepted or acted upon.


Have DataTables throw errors rather than alert() them.:

$.fn.dataTable.ext.errMode = 'throw';

$('#example').dataTable( {
  ajax: 'data.json'
} );


The following options are directly related and may also be useful in your application development.