github.com/henvic/wedeploycli@v1.7.6-0.20200319005353-3630f582f284/exiterror/exiterror.go (about) 1 package exiterror 2 3 // Error with exit code. 4 type Error struct { 5 Err string 6 code int 7 } 8 9 // Error message. 10 func (e Error) Error() string { 11 return e.Err 12 } 13 14 // Code for the exit syscall. 15 func (e Error) Code() int { 16 return e.code 17 } 18 19 // New returns an error that formats as the given text with an associated exit code. 20 func New(text string, code int) Error { 21 return Error{ 22 Err: text, 23 code: code, 24 } 25 }