-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
34 lines (26 loc) · 1.08 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
package statepro
import (
"errors"
"fmt"
)
// NoMachineDefinitionAvailableForIdErr used when no machine definition available for id
var NoMachineDefinitionAvailableForIdErr = errors.New("no machine definition available for id")
// ContextToSourceNotImplementedError used when contextToSourceFn is called but not implemented
var ContextToSourceNotImplementedError = errors.New("ContextToSource function not implemented")
// StateProNotInitializedErr used when statepro is not initialized
var StateProNotInitializedErr = errors.New("statepro not initialized. Call InitStatePro() before using any other statepro function")
// StateNotFountError used when state not found
type StateNotFountError struct {
EventName string
}
func (e *StateNotFountError) Error() string {
return fmt.Sprintf("Event '%s' not found", e.EventName)
}
// EventNotDefinedError used when event not defined in state
type EventNotDefinedError struct {
EventName string
StateName string
}
func (e *EventNotDefinedError) Error() string {
return fmt.Sprintf("Event '%s' not defined in state '%s'", e.EventName, e.StateName)
}