72YTXNCYKQBNEPS6ZL676JA4GZPMTWWOKDXKYAXPTNGBJCIZ7V7QC
// Package erratum is for error and recovery handling.
package erratum
// Use ...
func Use(opener ResourceOpener, hello string) (err error) {
var res Resource
for {
res, err = opener()
if err != nil {
// log.Printf("opener error type: %T", err)
if _, ok := err.(TransientError); ok {
continue
}
return err
}
break
}
defer res.Close()
defer func() {
if out := recover(); out != nil {
if frob, ok := out.(FrobError); ok {
res.Defrob(frob.defrobTag)
}
err = out.(error)
}
}()
res.Frob(hello)
if err != nil {
return err
}
return nil
}