Better error handling in case of place creation failure
This commit is contained in:
parent
0a9aafb620
commit
32af94fab8
2 changed files with 6 additions and 2 deletions
|
@ -263,7 +263,7 @@ class MicropubClientController extends Controller
|
|||
'headers' => $headers,
|
||||
]);
|
||||
} catch (ClientException $e) {
|
||||
//not sure yet...
|
||||
return false;
|
||||
}
|
||||
if ($response->getStatusCode() == 201) {
|
||||
return $response->getHeader('Location')[0];
|
||||
|
|
|
@ -70,7 +70,11 @@ EOD;
|
|||
->header('Content-Type', 'application/json');
|
||||
}
|
||||
if ($request->input('h') == 'card' || $request->input('type')[0] == 'h-card') {
|
||||
$place = $this->placeService->createPlace($request);
|
||||
try {
|
||||
$place = $this->placeService->createPlace($request);
|
||||
} catch (Exception $exception) {
|
||||
return response()->json(['error' => true], 400);
|
||||
}
|
||||
$content = <<<EOD
|
||||
{
|
||||
"response": "created",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue