Skip to content

Commit

Permalink
Relay more error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed May 12, 2024
1 parent 07efa02 commit 76197a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions includes/class-mastodon-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public function reformat_error_response( $result, $server, $request ) {
return $result;
}

if ( ! isset( $result['code'] ) && isset( $result['error'] ) && is_string( $result['error'] ) ) {
$result['code'] = sanitize_title_with_dashes( $result['error'] );
$result['message'] = $result['error'];
}

return array(
'error' => empty( $result['code'] ) ? __( 'unknown_error', 'enable-mastodon-apps' ) : $result['code'],
'error_description' => empty( $result['message'] ) ? __( 'Unknown error', 'enable-mastodon-apps' ) : $result['message'],
Expand Down

0 comments on commit 76197a4

Please sign in to comment.