-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
72 lines (49 loc) · 1.86 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-License-Identifier: BSD-3-Clause
package kiwi
import (
"fmt"
"runtime"
)
type Error string
func (e Error) Error() string { return string(e) }
const InternalSolverError = Error("Internal Solver Error")
const UnboundedObjective = Error("Objective is Unbounded")
const BadRequiredStrength = Error("Bad Required Strength")
const FailedToFindLeavingRow = Error("Failed to find Leaving Row")
const SyntaxError = Error("Syntax Error")
func EvaluationError(a ...interface{}) Error {
_, filename, line, _ := runtime.Caller(1)
return Error(fmt.Sprintf("Evaluation Error @ %s:%d (%s)", filename, line, fmt.Sprint(a...)))
}
type DuplicateConstraint struct{ *Constraint }
func (e DuplicateConstraint) Error() string {
return fmt.Sprintf("Duplicate Constraint: %v", e.Constraint)
}
type UnsatisfiableConstraint struct{ *Constraint }
func (e UnsatisfiableConstraint) Error() string {
return fmt.Sprintf("Unsatisfiable Constraint: %v", e.Constraint)
}
type UnknownConstraint struct{ *Constraint }
func (e UnknownConstraint) Error() string {
return fmt.Sprintf("Unknown Constraint: %v", e.Constraint)
}
type UnknownEditVariable struct{ *Variable }
func (e UnknownEditVariable) Error() string {
return fmt.Sprintf("Unknown Edit Variable: %v", e.Variable)
}
type DuplicateEditVariable struct{ *Variable }
func (e DuplicateEditVariable) Error() string {
return fmt.Sprintf("Duplicate Edit Variable: %v", e.Variable)
}
type UnknownStayVariable struct{ *Variable }
func (e UnknownStayVariable) Error() string {
return fmt.Sprintf("Unknown Stay Variable: %v", e.Variable)
}
type DuplicateStayVariable struct{ *Variable }
func (e DuplicateStayVariable) Error() string {
return fmt.Sprintf("Duplicate Stay Variable: %v", e.Variable)
}
type UnknownVariableName struct{ Name string }
func (e UnknownVariableName) Error() string {
return fmt.Sprintf("Unkown Variable Name: %q", e.Name)
}