I'd like to define a function that is called, whenever a shell-user types a command that does not exist. In my case I'd like to log the errors and try alternative commands.
currently, when typing e.g.
dgfgsdjagfghsdg the error
zsh: command not found: dgfgsdjagfghsdg is shown.
Is there a way to define a function, that get the typed command (+ arguments) as a parameter?