fn error_closure<T: TeeState + 'static>( state: T, ) -> Box<dyn Fn(&Context, &Promise<'_>, &Value<'_>)>