Browse Source

Merge pull request #5886 from andrewdacenko/patch-1

Restrict logging of errors with verbosity level
Jonas Jenwald 10 years ago
parent
commit
a931885ddd
  1. 11
      src/shared/util.js

11
src/shared/util.js

@ -208,17 +208,10 @@ function warn(msg) {
// Fatal errors that should trigger the fallback UI and halt execution by // Fatal errors that should trigger the fallback UI and halt execution by
// throwing an exception. // throwing an exception.
function error(msg) { function error(msg) {
// If multiple arguments were passed, pass them all to the log function. if (PDFJS.verbosity >= PDFJS.VERBOSITY_LEVELS.errors) {
if (arguments.length > 1) {
var logArguments = ['Error:'];
logArguments.push.apply(logArguments, arguments);
console.log.apply(console, logArguments);
// Join the arguments into a single string for the lines below.
msg = [].join.call(arguments, ' ');
} else {
console.log('Error: ' + msg); console.log('Error: ' + msg);
}
console.log(backtrace()); console.log(backtrace());
}
UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown); UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown);
throw new Error(msg); throw new Error(msg);
} }

Loading…
Cancel
Save