msgspec icon indicating copy to clipboard operation
msgspec copied to clipboard

What should dec_hook raise if the type is unsupported?

Open lunik1 opened this issue 1 year ago • 1 comments

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_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.
  • other?

lunik1 avatar Nov 20 '24 18:11 lunik1