Improved type system

This commit is contained in:
Eduard Urbach 2025-02-09 23:52:07 +01:00
parent c0ffddaba8
commit 2e3857622a
Signed by: eduard
GPG key ID: 49226B848C78F6C8
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)
}