mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 19:47:20 +00:00
Coloured warnings and errors under Node.js
This commit is contained in:
parent
9fedf38657
commit
5d600ce31b
@ -121,7 +121,7 @@ $tw.utils.error = function(err) {
|
|||||||
var errHeading = "Internal JavaScript Error",
|
var errHeading = "Internal JavaScript Error",
|
||||||
promptMsg = "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser";
|
promptMsg = "Well, this is embarrassing. It is recommended that you restart TiddlyWiki by refreshing your browser";
|
||||||
// Log the error to the console
|
// Log the error to the console
|
||||||
console.error(err);
|
console.error($tw.node ? "\x1b[1;31m" + err + "\x1b[0m" : err);
|
||||||
if($tw.browser && !$tw.node) {
|
if($tw.browser && !$tw.node) {
|
||||||
// Display an error message to the user
|
// Display an error message to the user
|
||||||
var dm = $tw.utils.domMaker,
|
var dm = $tw.utils.domMaker,
|
||||||
|
@ -12,6 +12,13 @@ Various static utility functions.
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Display a warning, in colour if we're on a terminal
|
||||||
|
*/
|
||||||
|
exports.warning = function(text) {
|
||||||
|
console.log($tw.node ? "\x1b[1;33m" + text + "\x1b[0m" : text);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Trim whitespace from the start and end of a string
|
Trim whitespace from the start and end of a string
|
||||||
Thanks to Steven Levithan, http://blog.stevenlevithan.com/archives/faster-trim-javascript
|
Thanks to Steven Levithan, http://blog.stevenlevithan.com/archives/faster-trim-javascript
|
||||||
|
Loading…
Reference in New Issue
Block a user