Skip to content

Commit

Permalink
Add error related helper
Browse files Browse the repository at this point in the history
  • Loading branch information
behzadsh committed Dec 31, 2018
1 parent 44b4faa commit 9c4eb58
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package shark

// PanicIfError panic exception if the given error is not nil
func PanicIfError(err error) {
if err != nil {
panic(err.Error())
}
}

// PanicIfErrCustomMsg panic with custom message if given error is not nil
func PanicIfErrorWithMessage(err error, message string) {
if err != nil {
panic(message)
}
}

0 comments on commit 9c4eb58

Please sign in to comment.