ahmeda's avatar

How to find the place of error in Laravel

How to find such an error where happened the large code base?

{
    "class": "Illuminate\Database\QueryException",
    "message": "SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'phone' at row 1 (Connection: mysql, SQL: update `contacts` set `name` = test, `phone` = 999993992998997995996994989939933, `contacts`.`updated_at` = 2024-03-17 10:00:02 where `id` = 116088)",
    "code": 22001,
    "file": "/home/forge/test.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:801",
0 likes
6 replies
MohamedTammam's avatar

You should trace the error log. The log should have more information that tracing the execution of the code.

ahmeda's avatar

@MohamedTammam there is nothing clear in trace

    "trace": [
        "/home/forge/test.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:755",
        "/home/forge/test.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:593",
        "/home/forge/test.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:545",
Snapey's avatar

in some controller where you update a contact. Do you have a ContactsController?

1 like
cabsey's avatar

It's not possible to work out from the error log you posted - you'll have to look around at everywhere a Contact is updated. It looks like it's just a case of the phone number field not being properly validated.

Please or to participate in this conversation.