diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2013-08-01 13:07:34 -0700 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2013-08-01 13:07:34 -0700 |
commit | 991a5ddd298562a9b0e37df25cb7e682519ccf7a (patch) | |
tree | ae941b585cab395c7b252cc446b1dc8180d013f3 /lib/scripts/helpers.js | |
parent | 5537fd88dc60d76d6a85202f715aa1ef585281a9 (diff) | |
parent | c6f665dd924dfa715fc19140c26d25eddcef9841 (diff) | |
download | dokuwiki-991a5ddd298562a9b0e37df25cb7e682519ccf7a.tar.gz dokuwiki-991a5ddd298562a9b0e37df25cb7e682519ccf7a.zip |
Merge pull request #238 from splitbrain/logjserrors
In debug mode: catch and log JS errors with file information
Diffstat (limited to 'lib/scripts/helpers.js')
-rw-r--r-- | lib/scripts/helpers.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/scripts/helpers.js b/lib/scripts/helpers.js index 632c4bff2..0b32e8781 100644 --- a/lib/scripts/helpers.js +++ b/lib/scripts/helpers.js @@ -49,3 +49,18 @@ function bind(fnc/*, ... */) { static_args.concat(Aps.call(arguments, 0))); }; } + +/** + * Report an error from a JS file to the console + * + * @param e The error object + * @param file The file in which the error occurred + */ +function logError(e, file) { + if (window.console && console.error) { + console.error('The error "%s: %s" occurred in file "%s". ' + + 'If this is in a plugin try updating or disabling the plugin, ' + + 'if this is in a template try updating the template or switching to the "dokuwiki" template.', + e.name, e.message, file); + } +} |