From 8a52476bbc7e2f2151adbddf47daa564cc8b5e52 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 8 Nov 2018 12:42:09 -0500 Subject: [PATCH] fix: clarify the wording of save error messages --- src/SaveToPath.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/SaveToPath.js b/src/SaveToPath.js index 281ef06..783a1e6 100644 --- a/src/SaveToPath.js +++ b/src/SaveToPath.js @@ -14,7 +14,7 @@ const ErrorModal = ({cancel, error}) => ( + >Ok ) @@ -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) + } ) }