From 942fe99fa36c2f18397ee5de5f64a4aff932dda0 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 30 May 2017 23:39:25 +0200 Subject: [PATCH] Show micropub error descriptions --- init.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/init.php b/init.php index 745d432..d561aa5 100644 --- a/init.php +++ b/init.php @@ -272,9 +272,18 @@ class Micropub extends Plugin implements IHandler $status = array_shift($headers); list($httpver, $code, $text) = explode(' ', $status, 3); if ($code != 201 && $code != 202) { + $errData = json_decode($content); + if (isset($errData->error_description) + && $errData->error_description != '' + ) { + return $this->errorOut( + 'Error creating post: ' + . $errData->error_description + ); + } return $this->errorOut( - 'An error occured: ' - . $code . ' ' . $text + 'Error creating post: ' + . $code . ' ' . $text.$content ); } -- 2.30.2