Use a channel instead of a trait object for handling errors