mathpan/error.go
2022-11-21 01:07:46 -05:00

25 lines
479 B
Go

package main
type Error int
const (
ErrorUnknownOpcode Error = iota
ErrorDivideByZero
ErrorWrongOperandCount
ErrorNegativeShiftAmount
)
func (err Error) Error () (description string) {
switch err {
case ErrorUnknownOpcode:
description = "unknown opcode"
case ErrorDivideByZero:
description = "division by zero"
case ErrorWrongOperandCount:
description = "wrong operand amount"
case ErrorNegativeShiftAmount:
description = "negative shift amount"
}
return
}