mirror of
https://github.com/Jguer/yay
synced 2024-10-02 22:33:47 +00:00
chore(text): make input overflow its own error
This commit is contained in:
parent
005c5c24b4
commit
f925b719e8
9
pkg/text/errors.go
Normal file
9
pkg/text/errors.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
package text
|
||||
|
||||
import "github.com/leonelquinteros/gotext"
|
||||
|
||||
type ErrInputOverflow struct{}
|
||||
|
||||
func (e ErrInputOverflow) Error() string {
|
||||
return gotext.Get("input too long")
|
||||
}
|
|
@ -4,8 +4,6 @@ import (
|
|||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/leonelquinteros/gotext"
|
||||
)
|
||||
|
||||
func GetInput(defaultValue string, noConfirm bool) (string, error) {
|
||||
|
@ -24,7 +22,7 @@ func GetInput(defaultValue string, noConfirm bool) (string, error) {
|
|||
}
|
||||
|
||||
if overflow {
|
||||
return "", fmt.Errorf(gotext.Get("input too long"))
|
||||
return "", ErrInputOverflow{}
|
||||
}
|
||||
|
||||
return string(buf), nil
|
||||
|
|
Loading…
Reference in a new issue