Raise valueerrors

This commit is contained in:
Stan Ulbrych 2025-07-13 07:55:11 +01:00
parent 609d5adc7c
commit cb8197ad6d
No known key found for this signature in database
GPG key ID: B8E58DBDB2A1A0B8
8 changed files with 52 additions and 16 deletions

View file

@ -11,11 +11,13 @@
### Codec APIs
def base64_encode(input, errors='strict'):
assert errors == 'strict'
if errors != 'strict':
raise ValueError(f'Unsupported error handling mode: "{errors}" - must be "strict"')
return (base64.encodebytes(input), len(input))
def base64_decode(input, errors='strict'):
assert errors == 'strict'
if errors != 'strict':
raise ValueError(f'Unsupported error handling mode: "{errors}" - must be "strict"')
return (base64.decodebytes(input), len(input))
class Codec(codecs.Codec):