diff --git a/js/components/ascribe_detail/edition_container.js b/js/components/ascribe_detail/edition_container.js index eac8fcb3..c49b87ba 100644 --- a/js/components/ascribe_detail/edition_container.js +++ b/js/components/ascribe_detail/edition_container.js @@ -55,7 +55,7 @@ let EditionContainer = React.createClass({ const { editionError } = this.state; if(editionError && editionError.status === 404) { - this.throws(new ResourceNotFoundError(getLangText('Ups, the edition you\'re looking for doesn\'t exist.'))); + this.throws(new ResourceNotFoundError(getLangText('Oops, the edition you\'re looking for doesn\'t exist.'))); } }, diff --git a/js/components/ascribe_detail/piece_container.js b/js/components/ascribe_detail/piece_container.js index 86c7fc74..0b4cfbb1 100644 --- a/js/components/ascribe_detail/piece_container.js +++ b/js/components/ascribe_detail/piece_container.js @@ -86,7 +86,7 @@ let PieceContainer = React.createClass({ const { pieceError } = this.state; if(pieceError && pieceError.status === 404) { - this.throws(new ResourceNotFoundError(getLangText('Ups, the piece you\'re looking for doesn\'t exist.'))); + this.throws(new ResourceNotFoundError(getLangText('Oops, the piece you\'re looking for doesn\'t exist.'))); } }, diff --git a/js/models/errors.js b/js/models/errors.js index 68d97c86..d7843d30 100644 --- a/js/models/errors.js +++ b/js/models/errors.js @@ -14,10 +14,14 @@ export class ResourceNotFoundError extends Error { } handler(component, err) { - if(!component.state._monkeyPatched) { + const { displayName } = component.constructor; + const monkeyPatchedKey = typeof displayName === 'string' ? `_${displayName}MonkeyPatched` + : '_monkeyPatched'; + + if(!component.state[monkeyPatchedKey]) { component.render = () => ; component.setState({ - _monkeyPatched: true + [monkeyPatchedKey]: true }); } }