Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/bugfix/error-support'
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Nov 11, 2016
2 parents 5ade317 + 39abedc commit 2503ad5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/react-pdf.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ export default class ReactPDF extends Component {
}

onDocumentError = () => {
if (
this.props.onDocumentError &&
typeof this.props.onDocumentError === 'function'
) {
this.props.onDocumentError();
}

this.setState({ pdf: false });
}

Expand All @@ -72,6 +79,13 @@ export default class ReactPDF extends Component {
}

onPageError = () => {
if (
this.props.onPageError &&
typeof this.props.onPageError === 'function'
) {
this.props.onPageError();
}

this.setState({ page: false });
}

Expand Down Expand Up @@ -200,7 +214,9 @@ ReactPDF.propTypes = {
error: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
file: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
loading: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
onDocumentError: PropTypes.func,
onDocumentLoad: PropTypes.func,
onPageError: PropTypes.func,
onPageLoad: PropTypes.func,
onPageRender: PropTypes.func,
pageIndex: PropTypes.number,
Expand Down

0 comments on commit 2503ad5

Please sign in to comment.