Intercept "command not located" mistake in zsh

Is there a means to obstruct the "command not located" mistake in ZSH? I've seen this is feasible in celebration evidently, yet I could not locate anything concerning doing it in zsh.

2019-05-13 05:32:59
Source Share
Answers: 1

There is ; it coincides as in bash, you make a function called command_not_found_handler. It'll be passed all the debates that were given up the shell

$ foobar baz
zsh: command not found: foobar
$ function command_not_found_handler() {echo "You tried to run $1 with arg $2";}
$ foobar baz
You tried to run foobar with arg baz
2019-05-17 18:36:03