You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
What should dec_hook raise if the type is unsupported? #774
There seems to be a (deliberate?) inconsistency in the docs regarding what exception dec_hook should raise if the expected message type is unsupported.
json.decode states that TypeError should be raised.
All other instances state that NotImplementedError should be raised.
Can you clarify which is correct?
dec_hook should raise TypeError for unsupported types
dec_hook should raise NotImplementedError for unsupported types
dec_hook should raise NotImplementedError for unsupported types, unless it is being passed to msgspec.json.decode when it should raise TypeError.
Oops, the TypeError there is incorrect (will fix). You should raise a NotImplementedError if the type is unsupported, and raise a TypeError/ValueError if the value doesn't match that type.
Activity
jcrist commentedon Nov 20, 2024
Oops, the
TypeErrorthere is incorrect (will fix). You should raise aNotImplementedErrorif the type is unsupported, and raise aTypeError/ValueErrorif the value doesn't match that type.Fix dec_hook exception type in json.decode docstring (msgspec#1127)