20 lines
542 B
Go
20 lines
542 B
Go
package errors
|
|
|
|
import "fmt"
|
|
|
|
// ParameterCountMismatch error is created when the number of parameters doesn't match the function prototype.
|
|
type ParameterCountMismatch struct {
|
|
Function string
|
|
Count int
|
|
ExpectedCount int
|
|
}
|
|
|
|
// Error generates the string representation.
|
|
func (err *ParameterCountMismatch) Error() string {
|
|
if err.Count > err.ExpectedCount {
|
|
return fmt.Sprintf("Too many parameters in '%s' function call", err.Function)
|
|
}
|
|
|
|
return fmt.Sprintf("Not enough parameters in '%s' function call", err.Function)
|
|
}
|