Skip to content

Commit

Permalink
Adds error reporting when publication fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
kalvn committed Feb 10, 2021
1 parent 69b1558 commit f9aa841
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shaarli2mastodon.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ function hook_shaarli2mastodon_save_link ($data, $conf) {
// If an error has occurred, not blocking: just log it.
if (isset($response['error'])) {
error_log('Mastodon API error: '. $response['error']);

if (session_status() == PHP_SESSION_ACTIVE) {
$_SESSION['errors'][] = 'Something went wrong when publishing the link on Mastodon. ' . $response['error'];
}
}

return $link;
Expand Down

0 comments on commit f9aa841

Please sign in to comment.