Skip to content

Commit a10c9c8

Browse files
committed
Also consider UserError in normal handler to be a message error
1 parent 88f7680 commit a10c9c8

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/handlers.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,15 @@ macro_rules! issue_handlers {
262262
if let Some(config) = &config.$name {
263263
$name::handle_input(ctx, config, event, input)
264264
.await
265-
.map_err(|e| {
266-
HandlerError::Other(e.context(format!(
267-
"error when processing {} handler",
268-
stringify!($name)
269-
)))
265+
.map_err(|mut e| {
266+
if let Some(err) = e.downcast_mut::<crate::errors::UserError>() {
267+
HandlerError::Message(err.to_string())
268+
} else {
269+
HandlerError::Other(e.context(format!(
270+
"error when processing {} handler",
271+
stringify!($name)
272+
)))
273+
}
270274
})
271275
} else {
272276
Err(HandlerError::Message(format!(

0 commit comments

Comments
 (0)