Improved type system

This commit is contained in:
2025-02-09 23:52:07 +01:00
parent 7634244c56
commit f19d9063a5
30 changed files with 132 additions and 85 deletions

View File

@ -0,0 +1,19 @@
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)
}