feat: use new errors pkg in pkg/apis/* - #4720
Conversation
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
| } | ||
| } | ||
| return errors.Errorf("failed to find container named %s in pod spec", containerName) | ||
| return errs.Errorf("failed to find container named %s in pod spec", containerName) |
There was a problem hiding this comment.
It's "not" * from within a struct and it's using a package level error, but it's because it's the pkg/apis/
There was a problem hiding this comment.
🤔 wait, why not put the errors library in the GameServer struct?
We don't want to recreate it on each invocation? (we could create a global one to reuse across gameservers that gets created on package creation on an empty GameServer struct?)
There was a problem hiding this comment.
Youps my comment is wrong, it's the way around, we dont use the error at struct level but at global / package level *
There was a problem hiding this comment.
And I didn't put that at struct level as there is no constructor, users will use it ditectly as the exported struct, which is why I set it as a global *
There was a problem hiding this comment.
Oh hmm, I think I just understood, let me check
There was a problem hiding this comment.
As in using a global one as: var gameserverErrors= errors.FromStruct(&GameServer{}) or var gameserverErrors= errors.FromStruct[GameServer](nil)
|
Build Succeeded 🥳 Build Id: 81e2b195-ab53-435d-a772-282862fdaca5 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
What type of PR is this?
/kind cleanup
What this PR does / Why we need it:
Use the new error package (https://github.com/agones-dev/agones/blob/main/pkg/util/errors/errors.go) on the pkg/apis/* files
Which issue(s) this PR fixes:
Work on #4510
Did you use AI tools in preparing this PR?:
Y
Special notes for your reviewer: