|
@@ -5,6 +5,27 @@ import (
|
|
"fmt"
|
|
"fmt"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+// Panic with test
|
|
|
|
+func Panic(err error) {
|
|
|
|
+ if err != nil {
|
|
|
|
+ panic(err)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// Panicf with test
|
|
|
|
+func Panicf(format string, err error) {
|
|
|
|
+ if err != nil {
|
|
|
|
+ panic(fmt.Errorf(format, err))
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// PanicfArgs with test
|
|
|
|
+func PanicfArgs(err error, format string, args ...interface{}) {
|
|
|
|
+ if err != nil {
|
|
|
|
+ panic(fmt.Errorf(format, args...))
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
// Check error function
|
|
// Check error function
|
|
func Check(format string, args ...interface{}) {
|
|
func Check(format string, args ...interface{}) {
|
|
var hasError bool
|
|
var hasError bool
|