"Complainer" -> "Error"
parent
33b8ec6287
commit
243e249506
|
@ -6,8 +6,8 @@ import (
|
|||
|
||||
var (
|
||||
errInternalError = errors.New("Internal Error")
|
||||
errInvalidUTF8 = internalInvalidUTF8Complainer{}
|
||||
errNilReader = internalNilReaderComplainer{}
|
||||
errInvalidUTF8 = internalInvalidUTF8Error{}
|
||||
errNilReader = internalNilReaderError{}
|
||||
errNilReceiver = errors.New("Nil Receiver")
|
||||
errNilWriter = internalNilWriterComplainer{}
|
||||
errNilWriter = internalNilWriterError{}
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package utf8
|
||||
|
||||
// InvalidUTF8Complainer is a type of error that could be returned
|
||||
// InvalidUTF8Error is a type of error that could be returned
|
||||
// by the utf8.ReadRune() function,
|
||||
// by the utf8.RuneReader.ReadRune() method, and
|
||||
// by the utf8.RuneScanner.ReadRune() method.
|
||||
|
@ -10,23 +10,23 @@ package utf8
|
|||
// r, n, err := utf8.ReadRune(reader)
|
||||
// if nil != err {
|
||||
// switch {
|
||||
// case utf8.InvalidUTF8Complainer:
|
||||
// case utf8.InvalidUTF8Error:
|
||||
// //@TODO
|
||||
// default:
|
||||
// //@TODO
|
||||
// }
|
||||
// }
|
||||
type InvalidUTF8Complainer interface {
|
||||
type InvalidUTF8Error interface {
|
||||
error
|
||||
InvalidUTF8Complainer()
|
||||
InvalidUTF8Error()
|
||||
}
|
||||
|
||||
type internalInvalidUTF8Complainer struct{}
|
||||
type internalInvalidUTF8Error struct{}
|
||||
|
||||
func (complainer internalInvalidUTF8Complainer) Error() string {
|
||||
func (complainer internalInvalidUTF8Error) Error() string {
|
||||
return "Invalid UTF-8"
|
||||
}
|
||||
|
||||
func (complainer internalInvalidUTF8Complainer) InvalidUTF8Complainer() {
|
||||
func (complainer internalInvalidUTF8Error) InvalidUTF8Error() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
10
nilreader.go
10
nilreader.go
|
@ -1,16 +1,16 @@
|
|||
package utf8
|
||||
|
||||
type NilReaderComplainer interface {
|
||||
type NilReaderError interface {
|
||||
error
|
||||
NilReaderComplainer()
|
||||
NilReaderError()
|
||||
}
|
||||
|
||||
type internalNilReaderComplainer struct{}
|
||||
type internalNilReaderError struct{}
|
||||
|
||||
func (complainer internalNilReaderComplainer) Error() string {
|
||||
func (complainer internalNilReaderError) Error() string {
|
||||
return "Nil Reader"
|
||||
}
|
||||
|
||||
func (complainer internalNilReaderComplainer) NilReaderComplainer() {
|
||||
func (complainer internalNilReaderError) NilReaderError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
10
nilwriter.go
10
nilwriter.go
|
@ -1,16 +1,16 @@
|
|||
package utf8
|
||||
|
||||
type NilWriterComplainer interface {
|
||||
type NilWriterError interface {
|
||||
error
|
||||
NilWriterComplainer()
|
||||
NilWriterError()
|
||||
}
|
||||
|
||||
type internalNilWriterComplainer struct{}
|
||||
type internalNilWriterError struct{}
|
||||
|
||||
func (complainer internalNilWriterComplainer) Error() string {
|
||||
func (complainer internalNilWriterError) Error() string {
|
||||
return "Nil Writer"
|
||||
}
|
||||
|
||||
func (complainer internalNilWriterComplainer) NilWriterComplainer() {
|
||||
func (complainer internalNilWriterError) NilWriterError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
// ReadRune reads a single UTF-8 encoded Unicode character from an io.Reader,
|
||||
// and returns the Unicode character (as a Go rune) and the number of bytes read.
|
||||
//
|
||||
// If ‘reader’ is nil then ReaderRune will return an error that matches utf8.NilReaderComplainer.
|
||||
// If ‘reader’ is nil then ReaderRune will return an error that matches utf8.NilReaderError.
|
||||
//
|
||||
// Example
|
||||
//
|
||||
|
@ -17,9 +17,9 @@ import (
|
|||
// if nil != err {
|
||||
//
|
||||
// switch err.(type) {
|
||||
// case utf8.NilReaderComplainer:
|
||||
// case utf8.NilReaderError:
|
||||
// //@TODO
|
||||
// case utf8.InvalidUTF8Complainer:
|
||||
// case utf8.InvalidUTF8Error:
|
||||
// //@TODO
|
||||
// default:
|
||||
// //TODO
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
// WriteRune writes a single UTF-8 encoded Unicode character and returns the number of bytes written.
|
||||
//
|
||||
// If ‘writer’ is nil then WriteRune will return an error that matches utf8.NilWriterComplainer.
|
||||
// If ‘writer’ is nil then WriteRune will return an error that matches utf8.NilWriterError.
|
||||
//
|
||||
// Example
|
||||
//
|
||||
|
@ -16,7 +16,7 @@ import (
|
|||
// if nil != err {
|
||||
//
|
||||
// switch err.(type) {
|
||||
// case utf8.NilWriterComplainer:
|
||||
// case utf8.NilWriterError:
|
||||
// //@TODO
|
||||
// default:
|
||||
// //TODO
|
||||
|
|
Loading…
Reference in New Issue