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): remove throw from pull request submission error…
Browse files Browse the repository at this point in the history
… handling

#567
  • Loading branch information
Ryan Garant committed Sep 15, 2018
1 parent a310da9 commit cc9eab8
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions lib/cmds/pull-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,25 +1050,18 @@ PullRequest.prototype._submitHandler = function() {

instance.submit(options.submit, function(err, pull) {
if (err) {
try {
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) {
if (err.code === 404) {
logger.error("Can't submit pull request. User Not Found")
if (err.code === 404) {
logger.error("Can't submit pull request. User Not Found")
} else {
err = JSON.parse(err.message).errors[0]

if (err.message) {
logger.error("Can't submit pull request. " + err.message)
} else {
logger.error(
"Can't submit pull request. " +
JSON.stringify(JSON.parse(err.message).errors[0])
)
logger.error("Can't submit pull request. " + JSON.stringify(err))
}
}

return
}

Expand Down

0 comments on commit cc9eab8

Please sign in to comment.