Skip to content

Commit

Permalink
feat: errors are not reported in report
Browse files Browse the repository at this point in the history
  • Loading branch information
kptdobe committed Sep 15, 2022
1 parent 4f538f4 commit 834cf25
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions js/import/import.ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ const attachListeners = () => {
// eslint-disable-next-line no-console
console.error(`Error importing ${url}: ${err.message}`, err);
alert.error(`Error importing ${url}: ${err.message}`);

importStatus.rows.push({
url,
status: `Error: ${err.message}`,
});
});

IMPORT_BUTTON.addEventListener('click', (async () => {
Expand Down Expand Up @@ -299,23 +304,13 @@ const attachListeners = () => {
window.setTimeout(async () => {
const { originalURL, replacedURL } = frame.dataset;
if (frame.contentDocument) {
try {
config.importer.setTransformationInput({
url: replacedURL,
document: frame.contentDocument,
includeDocx,
params: { originalURL },
});
await config.importer.transform();
} catch (e) {
// eslint-disable-next-line no-console
console.error(`Cannot transform ${originalURL} - transformation error ?`, e);
// fallback, probably transformation error
importStatus.rows.push({
url: originalURL,
status: `Error: ${e.message}`,
});
}
config.importer.setTransformationInput({
url: replacedURL,
document: frame.contentDocument,
includeDocx,
params: { originalURL },
});
await config.importer.transform();
}

const event = new Event('transformation-complete');
Expand Down

0 comments on commit 834cf25

Please sign in to comment.