[Bug]: No error or exception thrown for limit reached #3819
quantumwebco
started this conversation in
Ideas
Replies: 1 comment
-
Moved to discussions as this is a proposal not a bug. I would be open for a PR that adds a method |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?
What version of Laravel Excel are you using?
3.1
What version of Laravel are you using?
9.38
What version of PHP are you using?
8.1
Describe your issue
When defining a limit with the WithLimit concern there is no error or exception thrown. I would like to catch the exception with the number of rows that were imported or failed, or the row number it finished at
I have also tried manually adding a $limit property and throwing an exception in the
model()
method when it's reached but even with SkipsOnError, SkipsOnFailure and SkipsFailures, SkipsErrors it still rolls back the current importI did kind of work out a workaround by adding the index to the row in
prepareForValidation()
and then adding a max validation rule of the limit to the index property but it's kinda jankyHow can the issue be reproduced?
Throw an exception in the
model()
method or add a limit with theWithLimit
concernWhat should be the expected behaviour?
When the limit via the concern WithLimit is reached throw an exception that can be caught and an error message returned to the user or add rows after the limit is reached to the failures array to show with
$import->failures()
Throwing an exception from the
model()
method could push that row to the errors collection so it can be got with$import->errors()
after importing. If batch importing can all rows up to that exception still be imported? As per SkipsErrors/Failures, rather than just rolling backBeta Was this translation helpful? Give feedback.
All reactions