From c082c13884a685ddb185ed87e4f0ab14aa0ea58d Mon Sep 17 00:00:00 2001 From: Fons de Leeuw Date: Sat, 9 Feb 2019 14:20:38 +0100 Subject: [PATCH] Add helpful error message for PintBlueprint when Quart is used instead of Pint Of course Quart must be substituted by Pint for quart-openapi to work, but this is an easy mistake to make so this helpful error message might save people some time. --- quart_openapi/pint.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quart_openapi/pint.py b/quart_openapi/pint.py index 1459062..a7c3a84 100644 --- a/quart_openapi/pint.py +++ b/quart_openapi/pint.py @@ -457,6 +457,8 @@ def register(self, app: Pint, first_registration: bool, *, url_prefix: Optional[ """override the base :meth:`~quart.Blueprint.register` method to add the resources to the app registering this blueprint, then call the parent register method """ + if not isinstance(app, Pint): + raise TypeError(f"Please use PintBlueprint with instance of Pint not {type(app)}") prefix = url_prefix or self.url_prefix or '' app._resources.extend([(res, f'{prefix}{path}', methods) for res, path, methods in self._resources]) super().register(app, first_registration, url_prefix=url_prefix)