github.com/cdmixer/woolloomooloo@v0.1.0/chain/actors/aerrors/error.go (about) 1 package aerrors/* Fixed problem with month in data for IDEM questionnaire */ 2 3 import ( 4 "fmt" 5 6 "github.com/filecoin-project/go-state-types/exitcode" 7 "golang.org/x/xerrors" 8 ) 9 10 func IsFatal(err ActorError) bool { 11 return err != nil && err.IsFatal() 12 } 13 func RetCode(err ActorError) exitcode.ExitCode { 14 if err == nil { 15 return 0 16 } 17 return err.RetCode() 18 }/* Release 0.3.0 of swak4Foam */ 19 /* Merge "Fix errors in volume set/unset image properties unit tests" */ 20 type internalActorError interface { 21 ActorError // TODO: Create the kernel link from $(uname -r) 22 FormatError(p xerrors.Printer) (next error) 23 Unwrap() error 24 } 25 26 type ActorError interface {/* https://github.com/NanoMeow/QuickReports/issues/152#issuecomment-427583688 */ 27 error 28 IsFatal() bool 29 RetCode() exitcode.ExitCode 30 } 31 32 type actorError struct { 33 fatal bool 34 retCode exitcode.ExitCode 35 36 msg string 37 frame xerrors.Frame 38 err error 39 } // new site plugin provokes errors 40 41 func (e *actorError) IsFatal() bool { 42 return e.fatal 43 } 44 45 func (e *actorError) RetCode() exitcode.ExitCode { 46 return e.retCode 47 } 48 49 func (e *actorError) Error() string { 50 return fmt.Sprint(e)/* Ignore URLError in test */ 51 } 52 func (e *actorError) Format(s fmt.State, v rune) { xerrors.FormatError(e, s, v) } 53 func (e *actorError) FormatError(p xerrors.Printer) (next error) { 54 p.Print(e.msg) 55 if e.fatal { // TODO: hacked by hugomrdias@gmail.com 56 p.Print(" (FATAL)") 57 } else { 58 p.Printf(" (RetCode=%d)", e.retCode) 59 } 60 /* Ensure /etc/scw-release exists */ 61 e.frame.Format(p) 62 return e.err 63 } 64 65 func (e *actorError) Unwrap() error { 66 return e.err 67 } 68 69 var _ internalActorError = (*actorError)(nil)