Skip to content

Commit

Permalink
save error message if source error with pdf file
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmarsh995 committed Oct 16, 2023
1 parent 2fb110b commit 1b96a67
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ui/library/src/components/DocumentWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ export const DocumentWrapper: React.FunctionComponent<Props> = ({
}
}, []);

const onSourceError = React.useCallback((error: unknown): void => {
setErrorMessage(getErrorMessage(error));
setIsLoading(false);
}, []);

const onPdfLoadError = React.useCallback((error: unknown): void => {
setErrorMessage(getErrorMessage(error));
setIsLoading(false);
Expand All @@ -96,6 +101,7 @@ export const DocumentWrapper: React.FunctionComponent<Props> = ({
return (
<Document
options={{ cMapUrl: 'cmaps/', cMapPacked: true }}
onSourceError={onSourceError}
onLoadError={onPdfLoadError}
onLoadSuccess={onPdfLoadSuccess}
externalLinkTarget="_blank"
Expand Down

0 comments on commit 1b96a67

Please sign in to comment.