msgspec
msgspec copied to clipboard
What should dec_hook raise if the type is unsupported?
Question
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_hookshould raiseTypeErrorfor unsupported typesdec_hookshould raiseNotImplementedErrorfor unsupported typesdec_hookshould raiseNotImplementedErrorfor unsupported types, unless it is being passed tomsgspec.json.decodewhen it should raiseTypeError.- other?