From 582954a0520eb057c3fb3bb0b5edb46252b5f6b1 Mon Sep 17 00:00:00 2001 From: Friedl Ulrich Date: Sat, 19 Mar 2016 21:57:14 +0100 Subject: [PATCH] Fix error handling --- loop.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/loop.go b/loop.go index f56271f..7fe4704 100644 --- a/loop.go +++ b/loop.go @@ -20,8 +20,7 @@ func (r *Device) loop() { err := r.SetMode(RF_OPMODE_RECEIVER) if err != nil { - log.Print(err) - return + log.Fatal(err) } defer r.SetMode(RF_OPMODE_STANDBY) @@ -67,15 +66,14 @@ func (r *Device) loop() { } flags, err := r.readReg(REG_IRQFLAGS2) if err != nil { - return + log.Fatal(err) } if flags&RF_IRQFLAGS2_PAYLOADREADY == 0 { continue } data, err := r.readFifo() if err != nil { - log.Print(err) - return + log.Fatal(err) } if r.OnReceive != nil { go r.OnReceive(&data)