You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This probably requires a more complex Modifier interface, because modifiers can be applied in different moments, in different functions, that may or may not return an error. This will probably require an error channel. E.g. in Exchange functions, the modifiers are applied twice, and we would not be able to distinguish where it failed exactly (if we even want to).
A possible interface could be type Modifier func(e chan<- error) DHCPv6, where the caller passes either a valid error channel, or nil, and the modifier will write to that channel if it's not nil. This is still a bit cumbersome but it seems the simplest interface to me. Any ideas?
I'm not very familiar with Go.. this looks like a classic use for exceptions but I don't see a good way to do that in Go. The error channel is a good idea, but it's kinda complex.
I think I will change my suggestion to just panic if a modifier fails to apply. The rationale is that 1) I can't think on a situation where getting an error applying a modifier is not a bug (can you?) and 2) I think it's ok to panic when there's a bug.
It would be nice to check for errors when applying modifiers.
For instance:
The text was updated successfully, but these errors were encountered: