$.fn.dataTable.ext.errMode

Since: DataTables 1.10

Set how DataTables will report detected errors.

Description

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.

Types

string

Description:

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 )

Description:

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.

Parameters:
Returns:

No return is excepted or acted upon.

Example

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

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

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

Related

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