1313from openapi_core .schema .request_bodies .exceptions import MissingRequestBody
1414from openapi_core .schema .servers .exceptions import InvalidServer
1515from openapi_core .security .exceptions import SecurityError
16+ from openapi_core .templating .paths .exceptions import PathError
1617from openapi_core .unmarshalling .schemas .enums import UnmarshalContext
1718from openapi_core .unmarshalling .schemas .exceptions import (
1819 UnmarshalError , ValidateError ,
@@ -30,7 +31,7 @@ def validate(self, request):
3031 try :
3132 path , operation , _ , _ , _ = self ._find_path (request )
3233 # don't process if operation errors
33- except ( InvalidServer , InvalidPath , InvalidOperation ) as exc :
34+ except PathError as exc :
3435 return RequestValidationResult ([exc , ], None , None , None )
3536
3637 try :
@@ -53,7 +54,7 @@ def validate(self, request):
5354 def _validate_parameters (self , request ):
5455 try :
5556 path , operation , _ , _ , _ = self ._find_path (request )
56- except ( InvalidServer , InvalidPath , InvalidOperation ) as exc :
57+ except PathError as exc :
5758 return RequestValidationResult ([exc , ], None , None )
5859
5960 params , params_errors = self ._get_parameters (
@@ -67,7 +68,7 @@ def _validate_parameters(self, request):
6768 def _validate_body (self , request ):
6869 try :
6970 _ , operation , _ , _ , _ = self ._find_path (request )
70- except ( InvalidServer , InvalidOperation ) as exc :
71+ except PathError as exc :
7172 return RequestValidationResult ([exc , ], None , None )
7273
7374 body , body_errors = self ._get_body (request , operation )
0 commit comments