From 3544ce2bdc8b438a225fa20b36be7c1c8359f3d0 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Thu, 27 Jun 2024 22:19:59 -0700 Subject: [PATCH] Make DtypeError inherit from ValueError as well so that pydantic correctly wraps it in ValidationError --- src/numpydantic/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/numpydantic/exceptions.py b/src/numpydantic/exceptions.py index 252dbbd..a61258f 100644 --- a/src/numpydantic/exceptions.py +++ b/src/numpydantic/exceptions.py @@ -7,7 +7,7 @@ class InterfaceError(Exception): """Parent mixin class for errors raised by :class:`.Interface` subclasses""" -class DtypeError(TypeError, InterfaceError): +class DtypeError(ValueError, TypeError, InterfaceError): """Exception raised for invalid dtypes"""