...

Source file src/github.com/goph/emperror/utils.go

Documentation: github.com/goph/emperror

     1  package emperror
     2  
     3  // HandleRecover recovers from a panic and handles the error.
     4  //
     5  // 		defer emperror.HandleRecover(errorHandler)
     6  func HandleRecover(handler Handler) {
     7  	err := Recover(recover())
     8  	if err != nil {
     9  		handler.Handle(err)
    10  	}
    11  }
    12  
    13  // Handle handles an error whenever it occurs.
    14  func Handle(handler Handler, err error) {
    15  	if err != nil {
    16  		handler.Handle(err)
    17  	}
    18  }
    19  

View as plain text