return error instead of panic()

This commit is contained in:
Song Gao 2015-11-19 19:24:13 +00:00
parent d8e4f41ac8
commit acc2c8967a
2 changed files with 5 additions and 3 deletions

View file

@ -38,7 +38,7 @@ func TestBroadcast(t *testing.T) {
ifce, err := NewTAP("test")
if err != nil {
t.Fatal(err)
t.Fatalf("creating TAP error: %v\n", err)
}
setupIfce(t, net.IPNet{IP: self, Mask: mask}, ifce.Name())

View file

@ -2,10 +2,12 @@
package water
import "errors"
func newTAP(ifName string) (ifce *Interface, err error) {
panic("water: tap interface not implemented on this platform")
return nil, errors.New("tap interface not implemented on this platform")
}
func newTUN(ifName string) (ifce *Interface, err error) {
panic("water: tap interface not implemented on this platform")
return nil, errors.New("tap interface not implemented on this platform")
}