Add error handling in CommandInvoker