git.cweiske.de
/
tt-rss-micropub.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
91b3819
)
Show micropub error descriptions
v0.1.0
author
Christian Weiske
<cweiske@cweiske.de>
Tue, 30 May 2017 21:39:25 +0000
(23:39 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Tue, 30 May 2017 21:39:25 +0000
(23:39 +0200)
init.php
patch
|
blob
|
history
diff --git
a/init.php
b/init.php
index 745d432424a246172747c2af63687408f268b4b1..d561aa5421b561d2fe81269786625afdfb2bcf24 100644
(file)
--- 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) {
$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(
return $this->errorOut(
- '
An error occured
: '
- . $code . ' ' . $text
+ '
Error creating post
: '
+ . $code . ' ' . $text
.$content
);
}
);
}