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

Show cause of the error when fixture can't not be loaded #4529

Merged
merged 2 commits into from
Aug 10, 2023

Conversation

eduardor2k
Copy link
Contributor

When a fixture can't be loaded, you only get a generic error telling you which fixture can't be loaded, it would be more helpful if in that message we get the cause of the error

1) Unit\RequestApiTest::testCreate CException: Exception loading row req1 in fixture /var/www/html/test/yiitools/protected/tests/fixtures/requests.php

to

1) Unit\RequestApiTest::testCreate CException: Exception loading row req1 in fixture /var/www/html/test/yiitools/protected/tests/fixtures/requests.php Error: CDbCommand failed to execute the SQL statement: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '1691576897' for column 'date_added' at row 1

Q A
Is bugfix?
New feature?
Breaks BC?
Tests pass? ✔️
Fixed issues comma-separated list of tickets # fixed by the PR, if any

@what-the-diff
Copy link

what-the-diff bot commented Aug 9, 2023

PR Summary

  • Improved error messaging in the database fixture manager file
    The adjustment in the file CDbFixtureManager.php enhances the clarity of error messages experienced during its operation. Now, the specific error message from the system exception will be included, providing more detail for troubleshooting. This is crucial for speeding up problem identification and rectification.

Copy link
Member

@marcovtwout marcovtwout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original exception message is not lost (passed as 3rd argument to CException) but it might depend on the environment or error handler if you get to see the full stack trace containing that error.

The change looks helpful though and I see no BC issues. Could you add a line to the CHANGELOG as well?

@eduardor2k
Copy link
Contributor Author

Yes, no problem!

…ause of the error when fixture can't be loaded

When a fixture can't be loaded, you only get a generic error telling you which fixture can't be loaded, it would be more helpful if in that message we get the cause of the error
@eduardor2k
Copy link
Contributor Author

@marcovtwout done! Let me know if you need anything!

Improve and normalize changelog message
@marcovtwout marcovtwout merged commit f727815 into yiisoft:master Aug 10, 2023
12 checks passed
@marcovtwout
Copy link
Member

Merged, 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

Successfully merging this pull request may close these issues.

2 participants