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

Commit cc9eab8

Browse files
author
Ryan Garant
committed
fix(pull-request.js): remove throw from pull request submission error handling
#567
1 parent a310da9 commit cc9eab8

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

lib/cmds/pull-request.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,25 +1050,18 @@ PullRequest.prototype._submitHandler = function() {
10501050

10511051
instance.submit(options.submit, function(err, pull) {
10521052
if (err) {
1053-
try {
1054-
if (JSON.parse(err.message).errors[0].message) {
1055-
logger.error(
1056-
"Can't submit pull request. " +
1057-
JSON.parse(err.message).errors[0].message
1058-
)
1059-
} else {
1060-
throw Error
1061-
}
1062-
} catch (ignore) {
1063-
if (err.code === 404) {
1064-
logger.error("Can't submit pull request. User Not Found")
1053+
if (err.code === 404) {
1054+
logger.error("Can't submit pull request. User Not Found")
1055+
} else {
1056+
err = JSON.parse(err.message).errors[0]
1057+
1058+
if (err.message) {
1059+
logger.error("Can't submit pull request. " + err.message)
10651060
} else {
1066-
logger.error(
1067-
"Can't submit pull request. " +
1068-
JSON.stringify(JSON.parse(err.message).errors[0])
1069-
)
1061+
logger.error("Can't submit pull request. " + JSON.stringify(err))
10701062
}
10711063
}
1064+
10721065
return
10731066
}
10741067

0 commit comments

Comments
 (0)