OpenJS Foundation - openjsf.org · api.jquery.com

jQuery.error( message )Returns:

Description: Takes a string and throws an exception containing it.

This method exists primarily for plugin developers who wish to override it and provide a better display (or more information) for the error messages.

If you do override the method, remember to still throw an error at the end to preserve semantics.

Example:

Override jQuery.error to send it to a logging service, assuming the sendErrorLog method is provided by this service.

1

2

3

4

jQuery.error = function( message ) {

sendErrorLog( "jQuery error: " + message );

throw new Error( message );

};

Read the original on api.jquery.com ↗