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