Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(archive): Catch random errors in BoxArchive and throw preview error #1142

Merged
merged 3 commits into from
Jan 7, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/lib/viewers/archive/ArchiveViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import get from 'lodash/get';
import './Archive.scss';
import BaseViewer from '../BaseViewer';
import { VIEWER_EVENT } from '../../events';
import PreviewError from '../../PreviewError';
import { ERROR_CODE, VIEWER_EVENT } from '../../events';

const JS = ['archive.js'];
const CSS = ['archive.css'];
Expand Down Expand Up @@ -68,11 +69,12 @@ class ArchiveViewer extends BaseViewer {
return;
}

/*
global BoxArchive
The BoxArchive is loaded from archive.js
*/
this.archiveComponent = new BoxArchive(this.archiveEl, data);
try {
/* global BoxArchive loaded from archive.js */
this.archiveComponent = new BoxArchive(this.archiveEl, data);
} catch {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there not more descriptive errors thrown to the catch statement?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can refreshing resolve the issue for the user? Are these client-side issues or data issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can refreshing resolve the issue for the user? Are these client-side issues or data issues?

Refreshing probably cannot resolve the issue 😂. The issue maybe React issue or data issues.

throw new PreviewError(ERROR_CODE.LOAD_VIEWER, __('error_refresh'));
}

this.loaded = true;
this.emit(VIEWER_EVENT.load);
Expand Down