-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
instantiated error types not being generated/outputted #19
Comments
Hmm there is no obvious way to do it, it's hard for Tygo to have some generic way of dealing with instantiated variables. I would propose that the most straightforward way is to add some frontmatter manually, you can define It's not often I see raw export type error = string;
export const ErrFoodNotFound: error = "food not found";
export const ErrCompanyNotFound: error = "company not found";
export const ErrUserNotFound: error = "user not found"; Of course it's less than ideal to do it manually, but perhaps for your usecase it's fine? |
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error In golang an error satisifes this interface
I was hoping I could at least create a struct called Error with that interface and assign it. But if I can't use |
I found a good Go article for anyone interested in this issue: |
output:
I am trying to use this common pattern in go, but none of the instantiated errors are being generated
Is there a work around for this @gzuidhof
The text was updated successfully, but these errors were encountered: