Skip to content

Commit

Permalink
fix: clarify the wording of save error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmacdonald committed Nov 8, 2018
1 parent 43903cf commit 8a52476
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/SaveToPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ErrorModal = ({cancel, error}) => (
<Button
onClick={cancel}
bsStyle="success"
>Yes</Button>
>Ok</Button>
</Modal.Footer>
</Modal>
)
Expand Down Expand Up @@ -107,11 +107,21 @@ class SaveToPath extends Component {
this.props.usePR ?
cwrcGit.saveAsPullRequest(this.props.repo, this.props.path, this.props.content, this.state.prBranch, this.state.commitMessage, this.state.prTitle).then(
(result) => this.complete(),
(error) => this.displayError(error)
(error) => {
if (error.statusText === 'Internal Server Error') {
error.statusText = 'You do not have pull request permissions for the selected repository. Try saving to another repository you have pull request privileges for.'
}
this.displayError(error)
}
) :
cwrcGit.saveDoc(this.props.repo, this.props.path, this.props.content, this.state.branch, this.state.commitMessage).then(
(result) => this.complete(),
(error) => this.displayError(error)
(error) => {
if (error.statusText === 'Not Found') {
error.statusText = 'You do not have writing permissions for the selected repository. Try saving as a pull request or save to another repository you have writing privileges for.'
}
this.displayError(error)
}
)

}
Expand Down

0 comments on commit 8a52476

Please sign in to comment.