Browse Source

Error callback invoked on error during file read

pull/82/head
Matthew Holt 11 years ago
parent
commit
091ccffcb9
  1. 5
      papaparse.js
  2. 6
      player/player.js

5
papaparse.js

@ -221,6 +221,11 @@
if (isFunction(config.complete)) if (isFunction(config.complete))
config.complete(results); config.complete(results);
}; };
reader.onerror = function()
{
if (isFunction(config.error))
config.error(reader.error, _input);
};
reader.readAsText(_input, config.encoding); reader.readAsText(_input, config.encoding);
} }
} }

6
player/player.js

@ -66,6 +66,7 @@ function buildConfig()
worker: $('#worker').prop('checked'), worker: $('#worker').prop('checked'),
comments: $('#comments').val(), comments: $('#comments').val(),
complete: completeFn, complete: completeFn,
error: errorFn,
download: $('#download').prop('checked'), download: $('#download').prop('checked'),
keepEmptyRows: $('#keepEmptyRows').prop('checked'), keepEmptyRows: $('#keepEmptyRows').prop('checked'),
chunk: $('#chunk').prop('checked') ? chunkFn : undefined chunk: $('#chunk').prop('checked') ? chunkFn : undefined
@ -86,6 +87,11 @@ function chunkFn(results, file)
rows += results.data.length; rows += results.data.length;
} }
function errorFn(error, file)
{
console.log("ERROR:", error, file);
}
function completeFn() function completeFn()
{ {
end = performance.now(); end = performance.now();

Loading…
Cancel
Save