Do you want this as an interface or a helper class? I feel like the onError function would be similar for most classes and we would end up duplicating logic