Skip to content

Commit

Permalink
Merge pull request #833 from GrahamCampbell/fix-validation-errors
Browse files Browse the repository at this point in the history
Fixed handling of validation errors
  • Loading branch information
acrobat committed Nov 6, 2019
2 parents d281e29 + 1a42250 commit 1ed6cac
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Github/HttpClient/Plugin/GithubExceptionThrower.php
Expand Up @@ -76,13 +76,18 @@ public function doHandleRequest(RequestInterface $request, callable $next, calla
break;

default:
$errors[] = $error['message'];
if (isset($error['message'])) {
$errors[] = $error['message'];
}
break;

}
}

throw new ValidationFailedException('Validation Failed: '.implode(', ', $errors), 422);
throw new ValidationFailedException(
$errors ? 'Validation Failed: '.implode(', ', $errors) : 'Validation Failed',
422
);
}
}

Expand Down

0 comments on commit 1ed6cac

Please sign in to comment.