mirror of
https://github.com/inventree/InvenTree.git
synced 2025-09-13 06:01:35 +00:00
Data import fix (#10298)
* Data import fix - Improved error handling * Tweak frontend display of errors
This commit is contained in:
@@ -693,9 +693,20 @@ class DataImportRow(models.Model):
|
|||||||
try:
|
try:
|
||||||
instance = self.session.model_class.objects.get(pk=instance_id)
|
instance = self.session.model_class.objects.get(pk=instance_id)
|
||||||
except self.session.model_class.DoesNotExist:
|
except self.session.model_class.DoesNotExist:
|
||||||
raise DjangoValidationError(_('No record found with the provided ID.'))
|
self.errors = {
|
||||||
|
'non_field_errors': _('No record found with the provided ID')
|
||||||
|
+ f': {instance_id}'
|
||||||
|
}
|
||||||
|
return False
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise DjangoValidationError(_('Invalid ID format provided.'))
|
self.errors = {
|
||||||
|
'non_field_errors': _('Invalid ID format provided')
|
||||||
|
+ f': {instance_id}'
|
||||||
|
}
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
self.errors = {'non_field_errors': str(e)}
|
||||||
|
return False
|
||||||
|
|
||||||
serializer = self.construct_serializer(instance=instance, request=request)
|
serializer = self.construct_serializer(instance=instance, request=request)
|
||||||
|
|
||||||
|
@@ -285,7 +285,7 @@ export default function ImporterDataSelector({
|
|||||||
<IconCircleDashedCheck color='blue' size={16} />
|
<IconCircleDashedCheck color='blue' size={16} />
|
||||||
)}
|
)}
|
||||||
{!row.complete && !row.valid && (
|
{!row.complete && !row.valid && (
|
||||||
<HoverCard openDelay={50} closeDelay={100}>
|
<HoverCard openDelay={50} closeDelay={100} position='top-start'>
|
||||||
<HoverCard.Target>
|
<HoverCard.Target>
|
||||||
<IconExclamationCircle color='red' size={16} />
|
<IconExclamationCircle color='red' size={16} />
|
||||||
</HoverCard.Target>
|
</HoverCard.Target>
|
||||||
|
Reference in New Issue
Block a user