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

Illuminate\Database\QueryException #9755

Closed
JamborJan opened this issue Jul 26, 2015 · 6 comments
Closed

Illuminate\Database\QueryException #9755

JamborJan opened this issue Jul 26, 2015 · 6 comments

Comments

@JamborJan
Copy link

Preconditions

I am packaging an app called Paperwork which has been created with the Laravel Framework for a platform called Sandstorm. I first have build the package with Docker and now switched to Vagrant for that. I have a problem migrating old instances of the package which have been created with Docker to the new version.

Issue related to the Laravel Framework

At one point an error from the Laravel Framework is shown which indicates an issue with the MySQL connection or the database elsewhere but instead of showing a helpful SQL error a "Class not found" error is shown.

How to reproduce the issue

Take an existing app with database and rename a random used table to something else.

Expected behavior

The raised error should show a message like "table xyz not found" or something else helpful should be shown, like "advertised" in the code:

// If an exception occurs when attempting to run a query, we'll format the error
// message to include the bindings with SQL, which will make this exception a
// lot more helpful to the developer instead of just the database's errors.

Current behavior

The following message appears which doesn't help to track down the root cause:

 /opt/app/frontend/vendor/laravel/framework/src/Illuminate/Database/Connection.php 
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Class 'Illuminate\Database\QueryException' not found
        }

        // If an exception occurs when attempting to run a query, we'll format the error
        // message to include the bindings with SQL, which will make this exception a
        // lot more helpful to the developer instead of just the database's errors.
        catch (\Exception $e)
        {
            throw new QueryException(
                $query, $this->prepareBindings($bindings), $e
            );

I guess that the class QueryException is a component of the Laravel Framework which has been changed or doesn't work as expected.

Can you please help me with that? Am I guessing right or is the cause of the not so good fatal error exception not based in the Laravel Framework?

FYI: a screen shot of the error message:
bildschirmfoto 2015-07-26 um 16 18 09

@GrahamCampbell
Copy link
Member

Laravel 4.2 is not supported, sorry.

@JamborJan
Copy link
Author

It would be nice to have at least a useful hint like "upgrade to the latest framework". A "We are not helping" response is pretty lame.

@JamborJan
Copy link
Author

FYI, if anybody else has an older version of the framwork and gets an issue:

Add in paperwork/frontend/vendor/laravel/framework/src/Illuminate/Database/Connection.php this line at the beginning:

use Illuminate\Database\QueryException;

bildschirmfoto 2015-07-28 um 13 44 03

After having done that you get a proper error message and can start debugging.

@itsyahyaa
Copy link

// try this Way

increments('id'); $table->integer('role_id')->unsigned(); $table->string('name'); $table->string('email',50)->unique(); $table->string('username'); $table->string('password'); $table->boolean('active'); $table->rememberToken(); $table->timestamps(); }); } public function down() { Schema::dropIfExists('users'); } }

@lk77
Copy link

lk77 commented Jun 16, 2021

this is a very old issue that was closed nearly 6 years ago, i don't think it's usefull to comment here

@Temur23112003
Copy link

Zo'r gap yo'q malades bosing endi

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

5 participants