Skip to content

Commit

Permalink
Merge pull request #304 from linawolf/bugfix/sql-error
Browse files Browse the repository at this point in the history
[BUGFIX] Fix error message when there is an SQL error
  • Loading branch information
fsuter authored Oct 20, 2023
2 parents c4fea19 + 45ecd02 commit 2f9ea6e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Classes/Step/StoreDataStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -1041,13 +1041,18 @@ protected function reportTceErrors(array $errorLog): void
while ($row = $result->fetchAssociative()) {
// Check if there's a label for the message
$labelCode = 'msg_' . $row['type'] . '_' . $row['action'] . '_' . $row['details_nr'];
$label = LocalizationUtility::translate(
'LLL:EXT:belog/mod/locallang.xml:' . $labelCode,
'belog'
);
// If not, use details field
if (empty($label)) {
$label = $row['details'];
$dataArray = json_decode( $row['log_data'], true);
if ($dataArray !== null) {
$dataArray = json_decode( $row['log_data'], true);
$label = LocalizationUtility::translate(
'LLL:EXT:belog/Resources/Private/Language/locallang.xlf:' . $labelCode,
'belog',
[$dataArray['reason']??'unknown', ($dataArray['table']??'unknown table') . ': ' . $dataArray['uid']??'0']
);
}
if ($label === null) {
$label = $dataArray['reason'] ?? $dataArray['details'] ?? 'Unkown Reason';
}
// Substitute the first 5 items of extra data into the error message
$message = $label;
Expand Down

0 comments on commit 2f9ea6e

Please sign in to comment.