Skip to content

Commit

Permalink
Handle a failure to get the joke
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Jun 20, 2017
1 parent fed52a8 commit 066a7e6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dad-joke.el
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ If INSERT is non-nil the joke will be inserted into the current
buffer rather than shown in the minibuffer."
(interactive "P")
(let ((joke (dad-joke-get)))
(if insert
(insert joke)
(message joke))))
(if (and joke (not (zerop (length joke))))
(if insert
(insert joke)
(message joke))
(error "I didn't get the joke! :-("))))

(provide 'dad-joke)

Expand Down

0 comments on commit 066a7e6

Please sign in to comment.