15 Replies
What are you trying to achieve?
I want to make two validations:
check if the wallet is not empty, and amount of wallet is enough to make a transfer from wallet to another by this amount.
When i try to send a form i got this error
How i can handle these errors.
That error is being produced by the
laravel-wallet
package you're using, not Filament.yes how i can handle it
this's the problem
You'd use a
try ... catch
statement
But it depends on what bit of your code is triggering the exception and whether the laravel-wallet
package provides any other tools for handling those errors.
As an aside, it's almost always a bad idea to use a loose comparison operator ==
instead of strict comparison ===
. Especially when dealing with something like financial information.
https://abrictosecurity.com/php-type-juggling/I tried this
aah ok good thank you
Where did you find this exception?
i can return the error message in text input ?
before closing the modal
Thank you to share
The exception name is shown at the top of the image you shared of the error.
yes thank you.
Can i implement all these exceptions ? on the same catch
Yes, you can either add multiple catch blocks, each catching one or more exceptions, or use the union operator to specify multiple exceptions in a single catch:
aah ok i understand now
Thank you for your help.
If you have multiple in the same catch block, you can use
$exception instanceof BalanceIsEmpty
to test for each typeaah ok good idea.
How i can pass the exception error message from action to form and show it in the body form without closing the modal, with custom rule of text input.