Add error() to imperative event publishing