Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worries about postgresql errors #2097

Closed
dylanfcsr opened this issue Jul 19, 2019 · 1 comment
Closed

Worries about postgresql errors #2097

dylanfcsr opened this issue Jul 19, 2019 · 1 comment

Comments

@dylanfcsr
Copy link

Hello, there is a concern about any errors from postgresql

$validation->setRules([ 'utilisateur' => [ 'rules' => 'required|is_unique[fake]', 'label' => 'Nom d\'utilisateur', 'errors' => [ 'is_unique' => 'Un nom d\'utilisateur identique existe déjà' ] ] ]);

I'm trying to simulate an error using wrong is_unique an explicit error should I return

<br /> <b>Fatal error</b>: Uncaught CodeIgniter\Format\Exceptions\FormatException: Failed to parse json string, error: &quot;{0}&quot;. in /var/www/html/sda-car/vendor/codeigniter4/framework/system/Format/Exceptions/FormatException.php:9 Stack trace: #0 /var/www/html/sda-car/vendor/codeigniter4/framework/system/Format/JSONFormatter.php(66): CodeIgniter\Format\Exceptions\FormatException::forInvalidJSON('Type is not sup...') #1 /var/www/html/sda-car/vendor/codeigniter4/framework/system/API/ResponseTrait.php(370): CodeIgniter\Format\JSONFormatter-&gt;format(Array) #2 /var/www/html/sda-car/vendor/codeigniter4/framework/system/API/ResponseTrait.php(123): CodeIgniter\Debug\Exceptions-&gt;format(Array) #3 /var/www/html/sda-car/vendor/codeigniter4/framework/system/Debug/Exceptions.php(164): CodeIgniter\Debug\Exceptions-&gt;respond(Array, 500) #4 [internal function]: CodeIgniter\Debug\Exceptions-&gt;exceptionHandler(Object(ErrorException)) #5 {main} thrown in <b>/var/www/html/sda-car/vendor/codeigniter4/framework/system/Format/Exceptions/FormatException.php</b> on line <b>9</b><br /> { "title": "ErrorException", "type": "ErrorException", "code": 500, "message": "Uncaught CodeIgniter\\Format\\Exceptions\\FormatException: Failed to parse json string, error: \"{0}\". in /var/www/html/sda-car/vendor/codeigniter4/framework/system/Format/Exceptions/FormatException.php:9\nStack trace:\n#0 /var/www/html/sda-car/vendor/codeigniter4/framework/system/Format/JSONFormatter.php(66): CodeIgniter\\Format\\Exceptions\\FormatException::forInvalidJSON('Type is not sup...')\n#1 /var/www/html/sda-car/vendor/codeigniter4/framework/system/API/ResponseTrait.php(370): CodeIgniter\\Format\\JSONFormatter->format(Array)\n#2 /var/www/html/sda-car/vendor/codeigniter4/framework/system/API/ResponseTrait.php(123): CodeIgniter\\Debug\\Exceptions->format(Array)\n#3 /var/www/html/sda-car/vendor/codeigniter4/framework/system/Debug/Exceptions.php(164): CodeIgniter\\Debug\\Exceptions->respond(Array, 500)\n#4 [internal function]: CodeIgniter\\Debug\\Exceptions->exceptionHandler(Object(ErrorException))\n#5 {main}\n thrown", "file": "/var/www/html/sda-car/vendor/codeigniter4/framework/system/Format/Exceptions/FormatException.php", "line": 9, "trace": [ { "function": "shutdownHandler", "class": "CodeIgniter\\Debug\\Exceptions", "type": "->", "args": [] } ] }

But here is the error that is returned following this error,

This error but returned for all the postgreesql errors for example during a form I was sending a string, while my column was a column of type number, so it is not possible but instead to have an explicit error it made me the same mistake

@jim-parry
Copy link
Contributor

Your issue needs to be formatted so as to be readable, please.
You could use pastebin, or else formatting code in the post, from the toolstrip.
You might also explain your issue better, as your description is hard to follow.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants