Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
fix(pull-request.js): Update pull request send error handling
Browse files Browse the repository at this point in the history
fix #567
  • Loading branch information
jwu910 authored and Ryan Garant committed Sep 15, 2018
1 parent e4e1f17 commit a310da9
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/cmds/pull-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -1051,11 +1051,23 @@ PullRequest.prototype._submitHandler = function() {
instance.submit(options.submit, function(err, pull) {
if (err) {
try {
logger.error(
"Can't submit pull request. " + JSON.parse(err.message).errors[0].message
)
if (JSON.parse(err.message).errors[0].message) {
logger.error(
"Can't submit pull request. " +
JSON.parse(err.message).errors[0].message
)
} else {
throw Error
}
} catch (ignore) {
console.error(err)
if (err.code === 404) {
logger.error("Can't submit pull request. User Not Found")
} else {
logger.error(
"Can't submit pull request. " +
JSON.stringify(JSON.parse(err.message).errors[0])
)
}
}
return
}
Expand Down

0 comments on commit a310da9

Please sign in to comment.