summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go5
-rw-r--r--re.go6
2 files changed, 5 insertions, 6 deletions
diff --git a/main.go b/main.go
index a1ef640..afc4bda 100644
--- a/main.go
+++ b/main.go
@@ -38,6 +38,11 @@ func (n *Notify) Write(p []byte) (int, error) {
func privmsg(room string) irc.HandlerFunc {
last := make(map[string]string)
return func(conn *irc.Conn, line *irc.Line) {
+ defer func() {
+ if r := recover(); r != nil {
+ log.Println("panic", r)
+ }
+ }()
switch t := line.Text(); {
case isFlood(t):
if line.Nick != conn.Me().Nick {
diff --git a/re.go b/re.go
index 9406b79..341488c 100644
--- a/re.go
+++ b/re.go
@@ -1,17 +1,11 @@
package main
import (
- "log"
"regexp"
"strings"
)
func re(s, r string, global bool) string {
- defer func() {
- if r := recover(); r != nil {
- log.Println("panic", r)
- }
- }()
// min: at least two separators
if len(s) < 2 {
return ""