Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Fix/global vpn peers#320

Merged
nxtcoder17 merged 2 commits into
mainfrom
fix/global-vpn-peers
May 12, 2024
Merged

Fix/global vpn peers#320
nxtcoder17 merged 2 commits into
mainfrom
fix/global-vpn-peers

Conversation

@nxtcoder17
Copy link
Copy Markdown
Member

No description provided.

@nxtcoder17 nxtcoder17 requested a review from karthik1729 as a code owner May 12, 2024 17:20
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @nxtcoder17 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines +4094 to +4096
case "GlobalVPNDevice.creationMethod":
if e.complexity.GlobalVPNDevice.CreationMethod == nil {
break
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Consistency in error handling for 'CreationMethod' when nil.

Consider returning a specific error when 'CreationMethod' is nil, similar to other cases in the switch statement, to enhance error tracking and handling.

Suggested change
case "GlobalVPNDevice.creationMethod":
if e.complexity.GlobalVPNDevice.CreationMethod == nil {
break
case "GlobalVPNDevice.creationMethod":
if e.complexity.GlobalVPNDevice.CreationMethod == nil {
return nil, fmt.Errorf("creation method is nil for GlobalVPNDevice")
}

Comment on lines +27423 to +27448
func (ec *executionContext) _GlobalVPNDevice_creationMethod(ctx context.Context, field graphql.CollectedField, obj *entities.GlobalVPNDevice) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_GlobalVPNDevice_creationMethod(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.CreationMethod, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(string)
fc.Result = res
return ec.marshalOString2string(ctx, field.Selections, res)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Check for potential data type issues in '_GlobalVPNDevice_creationMethod'.

Ensure that the type assertion for 'resTmp' to 'string' is safe and consider handling possible assertion failures gracefully.

Suggested change
func (ec *executionContext) _GlobalVPNDevice_creationMethod(ctx context.Context, field graphql.CollectedField, obj *entities.GlobalVPNDevice) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_GlobalVPNDevice_creationMethod(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.CreationMethod, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
return graphql.Null
}
res := resTmp.(string)
fc.Result = res
return ec.marshalOString2string(ctx, field.Selections, res)
if resStr, ok := resTmp.(string); ok {
res = resStr
} else {
ec.Error(ctx, fmt.Errorf("type assertion to string failed"))
return graphql.Null
}

@nxtcoder17 nxtcoder17 merged commit e392647 into main May 12, 2024
@nxtcoder17 nxtcoder17 deleted the fix/global-vpn-peers branch May 12, 2024 17:23
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant