-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
47 lines (37 loc) · 1.07 KB
/
errors.go
File metadata and controls
47 lines (37 loc) · 1.07 KB
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
package rline
import (
"fmt"
"strings"
)
// Error is line reader error.
type Error string
// Error satisfies the error interface.
func (err Error) Error() string {
return string(err)
}
// Error values.
const ()
// ErrInvalidPromptType is the invalid prompt type error.
type ErrInvalidPromptType struct {
Type string
}
// Error satisfies the error interface.
func (err *ErrInvalidPromptType) Error() string {
return fmt.Sprintf("invalid prompt type %q", err.Type)
}
// ErrPromptNotAvailable is the prompt not available error.
type ErrPromptNotAvailable struct {
Name string
}
// Error satisfies the error interface.
func (err *ErrPromptNotAvailable) Error() string {
return fmt.Sprintf("%s prompt not available: try building with -tags 'rline_%s'", err.Name, strings.ToLower(err.Name))
}
// ErrPromptAlreadyInitialized is the prompt already initialized error.
type ErrPromptAlreadyInitialized struct {
Type string
}
// Error satisfies the error interface.
func (err *ErrPromptAlreadyInitialized) Error() string {
return fmt.Sprintf("%s prompt already initalized", err.Type)
}