4545from openapi_core .validation .request .exceptions import (
4646 MissingRequiredRequestBody ,
4747)
48- from openapi_core .validation .request .exceptions import ParameterError
4948from openapi_core .validation .request .exceptions import ParametersError
50- from openapi_core .validation .request .exceptions import RequestBodyError
51- from openapi_core .validation .request .exceptions import SecurityError
49+ from openapi_core .validation .request .exceptions import ParameterValidationError
50+ from openapi_core .validation .request .exceptions import (
51+ RequestBodyValidationError ,
52+ )
53+ from openapi_core .validation .request .exceptions import SecurityValidationError
5254from openapi_core .validation .schemas import (
5355 oas30_write_schema_validators_factory ,
5456)
@@ -95,7 +97,7 @@ def _iter_errors(
9597 try :
9698 self ._get_security (request .parameters , operation )
9799 # don't process if security errors
98- except SecurityError as exc :
100+ except SecurityValidationError as exc :
99101 yield exc
100102 return
101103
@@ -106,15 +108,15 @@ def _iter_errors(
106108
107109 try :
108110 self ._get_body (request .body , request .mimetype , operation )
109- except RequestBodyError as exc :
111+ except RequestBodyValidationError as exc :
110112 yield exc
111113
112114 def _iter_body_errors (
113115 self , request : BaseRequest , operation : Spec
114116 ) -> Iterator [Exception ]:
115117 try :
116118 self ._get_body (request .body , request .mimetype , operation )
117- except RequestBodyError as exc :
119+ except RequestBodyValidationError as exc :
118120 yield exc
119121
120122 def _iter_parameters_errors (
@@ -130,7 +132,7 @@ def _iter_security_errors(
130132 ) -> Iterator [Exception ]:
131133 try :
132134 self ._get_security (request .parameters , operation )
133- except SecurityError as exc :
135+ except SecurityValidationError as exc :
134136 yield exc
135137
136138 def _get_parameters (
@@ -158,7 +160,7 @@ def _get_parameters(
158160 value = self ._get_parameter (parameters , param )
159161 except MissingParameter :
160162 continue
161- except ParameterError as exc :
163+ except ParameterValidationError as exc :
162164 errors .append (exc )
163165 continue
164166 else :
@@ -171,7 +173,7 @@ def _get_parameters(
171173 return validated
172174
173175 @ValidationErrorWrapper (
174- ParameterError ,
176+ ParameterValidationError ,
175177 InvalidParameter ,
176178 "from_spec" ,
177179 spec = "param" ,
@@ -197,7 +199,7 @@ def _get_parameter(
197199 raise MissingRequiredParameter (name , param_location )
198200 raise MissingParameter (name , param_location )
199201
200- @ValidationErrorWrapper (SecurityError , InvalidSecurity )
202+ @ValidationErrorWrapper (SecurityValidationError , InvalidSecurity )
201203 def _get_security (
202204 self , parameters : RequestParameters , operation : Spec
203205 ) -> Optional [Dict [str , str ]]:
@@ -236,7 +238,7 @@ def _get_security_value(
236238 security_provider = self .security_provider_factory .create (scheme )
237239 return security_provider (parameters )
238240
239- @ValidationErrorWrapper (RequestBodyError , InvalidRequestBody )
241+ @ValidationErrorWrapper (RequestBodyValidationError , InvalidRequestBody )
240242 def _get_body (
241243 self , body : Optional [str ], mimetype : str , operation : Spec
242244 ) -> Any :
0 commit comments