Shell_command catch exit value in automation?

shell_command:
  dns_check: host google.com || exit 1

How can I catch in an automation if the shell command executed successfully, or not? So I can send notifications in case the check was not successfull.

could solve it with command_line:

  - platform: command_line
    name: "dns_state"
    command: "host google.com > /dev/null && echo 0 || echo 1"
    payload_on: 1
    payload_off: 0