Skip to content

Commit b20121e

Browse files
committed
Change to a RuntimeError if neither pydantic nor msgspec are installed
As a TypeError is picked up by Quart and turned into a BadRequest, rather than crashing as a programming error.
1 parent 7e3ee02 commit b20121e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/quart_schema/conversion.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def model_load(
183183
elif _use_msgspec(model_class, preference):
184184
return convert(data, model_class, strict=False)
185185
elif not PYDANTIC_INSTALLED and not MSGSPEC_INSTALLED:
186-
raise TypeError(f"Cannot load {model_class} - try installing msgspec or pydantic")
186+
raise RuntimeError(f"Cannot load {model_class} - try installing msgspec or pydantic")
187187
else:
188188
raise TypeError(f"Cannot load {model_class}")
189189
except (TypeError, MsgSpecValidationError, PydanticValidationError, ValueError) as error:

0 commit comments

Comments
 (0)