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

Can oops.Code() support multiple data types? #33

Open
OneSeven opened this issue Nov 21, 2024 · 2 comments
Open

Can oops.Code() support multiple data types? #33

OneSeven opened this issue Nov 21, 2024 · 2 comments

Comments

@OneSeven
Copy link

In many existing projects, most of the code is of int type, and type conversion is required every time it is passed in and read out.

@samber
Copy link
Owner

samber commented Nov 21, 2024

I agree, but some projects also use strings. When I added `oops.Code(), I hesitated between both types, and concluded that a numeric value could be converted into a string, but not the opposite.

I suppose an any value could fill the gap.

@OneSeven
Copy link
Author

I agree, but some projects also use strings. When I added `oops.Code(), I hesitated between both types, and concluded that a numeric value could be converted into a string, but not the opposite.

I suppose an any value could fill the gap.

Can we add a new API, similar to AnyCode(), so that when passing in the data, there is no need to perform type conversion, and the error handling is centralized and unified, and type conversion is only performed at the end?

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

No branches or pull requests

2 participants