mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 02:59:29 +00:00
Show validation error messages in mapping step
This commit is contained in:
parent
72e3766be5
commit
1d33d95c57
1 changed files with 11 additions and 1 deletions
|
|
@ -378,7 +378,7 @@ class ProjectController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are validation errors, show them and stop
|
// If there are validation errors, show them and stop
|
||||||
if (!empty($validation_result['errors'])) {
|
if (!empty($validation_result['errors'])) {
|
||||||
foreach ($validation_result['errors'] as $error) {
|
foreach ($validation_result['errors'] as $error) {
|
||||||
$this->addFlash('error', $error);
|
$this->addFlash('error', $error);
|
||||||
}
|
}
|
||||||
|
|
@ -449,6 +449,16 @@ class ProjectController extends AbstractController
|
||||||
// When we get here, there were validation errors
|
// When we get here, there were validation errors
|
||||||
$this->addFlash('error', t('project.bom_import.flash.invalid_entries'));
|
$this->addFlash('error', t('project.bom_import.flash.invalid_entries'));
|
||||||
|
|
||||||
|
//Print validation errors to log for debugging
|
||||||
|
foreach ($errors as $error) {
|
||||||
|
$logger->error('BOM entry validation error', [
|
||||||
|
'message' => $error->getMessage(),
|
||||||
|
'invalid_value' => $error->getInvalidValue(),
|
||||||
|
]);
|
||||||
|
//And show as flash message
|
||||||
|
$this->addFlash('error', $error->getMessage(),);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (\UnexpectedValueException | SyntaxError $e) {
|
} catch (\UnexpectedValueException | SyntaxError $e) {
|
||||||
$this->addFlash('error', t('project.bom_import.flash.invalid_file', ['%message%' => $e->getMessage()]));
|
$this->addFlash('error', t('project.bom_import.flash.invalid_file', ['%message%' => $e->getMessage()]));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue