-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat: error message show field name #7452
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
Conversation
@@ -78,7 +78,7 @@ func (schema *Schema) parseRelation(field *Field) *Relationship { | |||
cacheStore := schema.cacheStore | |||
|
|||
if relation.FieldSchema, err = getOrParse(fieldValue, cacheStore, schema.namer); err != nil { | |||
schema.err = err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change the error message to:
failed to parse field: %v, error: %w
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经根据建议修改,是否考虑为 schema.Field 添加 String() 方法
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不加吧,一般没有必要
schema/relationship.go
Outdated
@@ -78,7 +78,7 @@ func (schema *Schema) parseRelation(field *Field) *Relationship { | |||
cacheStore := schema.cacheStore | |||
|
|||
if relation.FieldSchema, err = getOrParse(fieldValue, cacheStore, schema.namer); err != nil { | |||
schema.err = fmt.Errorf("%w. The field name is %s", err, field.Name) | |||
schema.err = fmt.Errorf("failed to parse field: %v, error: %w", field, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
field
-> field.Name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
What did this pull request do?
User Case Description