go-utf8/invalidutf8.go

33 lines
680 B
Go
Raw Permalink Normal View History

2022-07-18 23:36:02 +00:00
package utf8
2018-07-02 09:16:14 +00:00
2023-08-18 12:57:56 +00:00
// InvalidUTF8Error is a type of error that could be returned
2022-07-19 02:44:50 +00:00
// by the utf8.ReadRune() function,
// by the utf8.RuneReader.ReadRune() method, and
// by the utf8.RuneScanner.ReadRune() method.
//
// Here is how one might use this type:
//
// r, n, err := utf8.ReadRune(reader)
// if nil != err {
// switch {
2023-08-18 12:57:56 +00:00
// case utf8.InvalidUTF8Error:
2022-07-19 02:44:50 +00:00
// //@TODO
// default:
// //@TODO
// }
// }
2023-08-18 12:57:56 +00:00
type InvalidUTF8Error interface {
2018-07-02 09:16:14 +00:00
error
2023-08-18 12:57:56 +00:00
InvalidUTF8Error()
2018-07-02 09:16:14 +00:00
}
2023-08-18 12:57:56 +00:00
type internalInvalidUTF8Error struct{}
2018-07-02 09:16:14 +00:00
2023-08-18 12:57:56 +00:00
func (complainer internalInvalidUTF8Error) Error() string {
2018-07-02 09:16:14 +00:00
return "Invalid UTF-8"
}
2023-08-18 12:57:56 +00:00
func (complainer internalInvalidUTF8Error) InvalidUTF8Error() {
2018-07-02 09:16:14 +00:00
// Nothing here.
}