From 6e1bd23a28cc6f1bf14de47d18b89dff928ed680 Mon Sep 17 00:00:00 2001 From: Liam Stanley Date: Thu, 17 Aug 2017 05:02:18 -0400 Subject: [PATCH] move error checks to the front, as it's likely to not have a source --- event.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/event.go b/event.go index e93f0fe..77d9b45 100644 --- a/event.go +++ b/event.go @@ -280,6 +280,10 @@ func (e *Event) Pretty() (out string, ok bool) { return "", false } + if e.Command == ERROR { + return fmt.Sprintf("[*] an error occurred: %s", e.Trailing), true + } + if e.Source == nil { if e.Command != PRIVMSG && e.Command != NOTICE { return "", false @@ -329,10 +333,6 @@ func (e *Event) Pretty() (out string, ok bool) { return fmt.Sprintf("[*] %s (%s) has left %s (%s)", e.Source.Name, e.Source.Host, e.Params[0], e.Trailing), true } - if e.Command == ERROR { - return fmt.Sprintf("[*] an error occurred: %s", e.Trailing), true - } - if e.Command == QUIT { return fmt.Sprintf("[*] %s has quit (%s)", e.Source.Name, e.Trailing), true }