Gopher2600/errors/errors.go
steve 46b8173b7b o replaced debugger/input package with debugger/commandline
- improved how command template are compiled
    - verification and tab completion is now more robust
    - missing repeat groups

o debugger
    - extended PLAYER and MISSILE commands
    - combined STICK1 and STICK2 into one STICK command
2020-01-05 18:58:32 +00:00

28 lines
668 B
Go

package errors
import "fmt"
// Errno is used specified the specific error
type Errno int
// Values is the type used to specify arguments for FormattedErrors
type Values []interface{}
// FormattedError provides a convenient way of providing arguments to a
// predefined error
type FormattedError struct {
Errno Errno
Values Values
}
// NewFormattedError is used to create a new instance of a FormattedError
func NewFormattedError(errno Errno, values ...interface{}) FormattedError {
er := new(FormattedError)
er.Errno = errno
er.Values = values
return *er
}
func (er FormattedError) Error() string {
return fmt.Sprintf(messages[er.Errno], er.Values...)
}