Skip to content

Commit

Permalink
Fix when capturing errors from the Loader result.
Browse files Browse the repository at this point in the history
Sometimes the `field` and `message` elements are not present,
so cater for that with a null coolesce operator.
Also return other fields that may be present.
  • Loading branch information
judgej committed Apr 18, 2019
1 parent 3520a4f commit d0c0eb2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/App/LoaderRecordResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public function getMessages()
}

foreach($this->result_source['messages'] as $message) {
// TODO: decipher more of the array to provide useful information.
$messages[] = array(
'field' => $message['field'],
'message' => $message['message'],
'field' => $message['field'] ?? 'unknown',
'message' => $message['message'] ?? 'unknown',
'full' => json_encode($message),
);
}

Expand Down

0 comments on commit d0c0eb2

Please sign in to comment.