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

Custom error #16

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Custom error #16

wants to merge 12 commits into from

Conversation

eduardo-mior
Copy link

Make sure these boxes checked before submitting your pull request.

  • Do only one thing
  • No API-breaking changes
  • New code/logic commented & tested

For significant changes like big bug fixes, new features, please open an issue to make an agreement on an implementation design/plan first before starting it.

What did this pull request do?

  • Add a field called SQL to the DB stuct. This SQL field contains a String with the last SQL executed.
  • Create a custom error that contains the original error and contains the SQL string that caused the error. With this custom error it is possible which SQL caused the error, this way it is possible to record in sentry and other platforms what happened, it is a better way to know what error is happening.

Looking at my project's error logs, the only thing that comes up is `pq: syntax error at or near") ". I have about 10 ")" in my SQL. How will I know where the error is happening without running SQL? With this new custom error, and with this new SQL property I can know which SQL is causing the problem.

@Gilwe
Copy link

Gilwe commented Jun 30, 2021

isn't this repo deprecated?

@eduardo-mior
Copy link
Author

isn't this repo deprecated?

Yes. This repository is obsolete. But I'm doing maintenance on giant projects that use this repository, and unfortunately I don't have the possibility for GORM V2

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