Skip to main content

error

method Console.error
Jump to headingConsole.error(
message?: any,
...optionalParams: any[],
): void

Prints to stderr with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

const code = 5;
console.error('error #%d', code);
// Prints: error #5, to stderr
console.error('error', code);
// Prints: error 5, to stderr

If formatting elements (e.g. %d) are not found in the first string then util.inspect() is called on each argument and the resulting string values are concatenated. See util.format() for more information.

Parameters Jump to heading

optional
Jump to headingmessage: any
Jump to heading<span>...optionalParams</span>: any[]

Return Type Jump to heading

void
Back to top