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,
|
'headers' => $headers,
|
||||||
]);
|
]);
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
//not sure yet...
|
return false;
|
||||||
}
|
}
|
||||||
if ($response->getStatusCode() == 201) {
|
if ($response->getStatusCode() == 201) {
|
||||||
return $response->getHeader('Location')[0];
|
return $response->getHeader('Location')[0];
|
||||||
|
|
|
@ -70,7 +70,11 @@ EOD;
|
||||||
->header('Content-Type', 'application/json');
|
->header('Content-Type', 'application/json');
|
||||||
}
|
}
|
||||||
if ($request->input('h') == 'card' || $request->input('type')[0] == 'h-card') {
|
if ($request->input('h') == 'card' || $request->input('type')[0] == 'h-card') {
|
||||||
|
try {
|
||||||
$place = $this->placeService->createPlace($request);
|
$place = $this->placeService->createPlace($request);
|
||||||
|
} catch (Exception $exception) {
|
||||||
|
return response()->json(['error' => true], 400);
|
||||||
|
}
|
||||||
$content = <<<EOD
|
$content = <<<EOD
|
||||||
{
|
{
|
||||||
"response": "created",
|
"response": "created",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue