You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide a detailed error message during Create/Save/Update...
User Case Description
Currently the error message too simple to diagnostic what's happened.
It's relative to #7510. I don't think the code is good. But to achieve the goal, we have to change our minds on error handling.
My opinion is create a customized error type, even it's internal. But looks like you don't like it? (Of course I understand it's difficult to make decision about make the error type public or not)
propel-code-botbot
changed the title
feat: make a more detailed error message during field value setting failed
feat: Provide detailed error messages for field.Set failures
Nov 20, 2025
Adds a thin wrapper around every generated field.Set function in schema/field.go to prepend the field name to any propagated error. This gives users clearer diagnostics during Create/Save/Update operations without changing the public API or the original error value (wrapped with %w).
Key Changes
• Introduced local variable oldSetter and reassigned field.Set with a closure that calls oldSetter, inspects the returned error, and if not nil wraps it using fmt.Errorf("failed to set value to field %s: %w", field.Name, err)
• Added duplicate-prevention logic that aborts wrapping when the error text already contains "to field "
• Imported strings where necessary (already present in file)
Affected Areas
• schema/field.go – generation of every field.Set implementation
• fallbackSetter call sites indirectly affected because wrapped errors now propagate
This summary was automatically generated by @propel-code-bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What did this pull request do?
Provide a detailed error message during Create/Save/Update...
User Case Description
Currently the error message too simple to diagnostic what's happened.
It's relative to #7510. I don't think the code is good. But to achieve the goal, we have to change our minds on error handling.
My opinion is create a customized error type, even it's internal. But looks like you don't like it? (Of course I understand it's difficult to make decision about make the error type public or not)