Share via


error method

Sends an error "message" to the console. The message text color is red and it is prefaced by an error icon.

 

Syntax

Console.error(message, optionalParams);

Parameters

  • message [in]
    Type: DOMString

    The message to display.

  • optionalParams [in]
    Type: any

    A value or string that can be used with replaceable parameters in the main message.

Return value

This method does not return a value.

Remarks

The optional parameters can be used to provide a replaceable value in the message. For example, you could include a specific error code as the optional parameter, rather than building a string by concatenating the error code to the message string.

  function sendErrorConsole(errorCode) {
        window.console.error("Error: %s occured", errorCode);
    }

See also

Console