added try catch to the command handler