Replace an invalid input with a valid output.
Modulererebase-1.21.2Haskell2010
Data.Text.Encoding.Error
- 4 types
- 5 values
- Packagererebase-1.21.2
- Exports9
- LanguageHaskell2010
- LicenceMIT
- SourceError.hs
An exception type for representing Unicode encoding errors.
Constructors
DecodeError String (Maybe Word8)Could not decode a byte sequence because it was invalid under the given encoding, or ran out of input in mid-decode.
EncodeError String (Maybe Char)Tried to encode a character that could not be represented under the given encoding, or ran out of input in mid-encode.
Instances4Eq, Show, Exception, NFData
Eq UnicodeExceptionDefined in text-2.1.3 · Data.Text.Encoding.ErrorShow UnicodeExceptionDefined in text-2.1.3 · Data.Text.Encoding.ErrorException UnicodeExceptionDefined in text-2.1.3 · Data.Text.Encoding.ErrorNFData UnicodeExceptionDefined in text-2.1.3 · Data.Text.Encoding.Error
Throw a UnicodeException if decoding fails.
A handler for a decoding error.
Replace an invalid input byte with the Unicode replacement character U+FFFD.
Ignore an invalid input, substituting nothing in the output.
Deprecated. This function always throws an exception, and will be removed.
Throw a UnicodeException if encoding fails.
Deprecated. This exception is never used in practice, and will be removed.
A handler for an encoding error.
Function type for handling a coding error. It is supplied with two inputs:
A String that describes the error.
The input value that caused the error. If the error arose because the end of input was reached or could not be identified precisely, this value will be Nothing.
If the handler returns a value wrapped with Just, that value will be used in the output as the replacement for the invalid input. If it returns Nothing, no value will be used in the output.
Should the handler need to abort processing, it should use error or throw an exception (preferably a UnicodeException). It may use the description provided to construct a more helpful error report.