// CheckError prints the cause of the given error and exits the code with an
// exit code of 1.
// If the context is provided, then that is printed, if not, then the cause is
// detected using errors.Cause(err)
CheckError prints the cause of the given error and exits the code with an
exit code of 1.
If the context is provided, then that is printed, if not, then the cause is
detected using errors.Cause(err)
// CheckError prints the cause of the given error and exits the code with an // exit code of 1 . // If the context is provided then that is printed if not then the cause is // detected using errors . Cause ( err )
func CheckError(err error, context string, a ...interface{}) {
	if err != nil {
		glog.V(4).Infof("Error:\n%v", err)
		if context == "" {
			fmt.Println(errors.Cause(err))
		} else {
			fmt.Printf(fmt.Sprintf("%s\n", context), a...)
		}
		os.Exit(1)
	}
}
func CheckError ( err error , context string , a ... interface { } ) { if err != nil { glog . V ( 4 ) . Infof ( " \n " , err ) if context == " " { fmt . Println ( errors . Cause ( err ) ) } else { fmt . Printf ( fmt . Sprintf ( " \n " , context ) , a ... ) } os . Exit ( 1 ) } }
CheckError prints the cause of the given error and exits the code with an
exit code of 1.
CheckError prints the cause of the given error and exits the code with an exit code of 1 .