Skip to content

Commit 9baa27a

Browse files
committed
Change base ValidatorException name
1 parent fdbc130 commit 9baa27a

File tree

6 files changed

+55
-55
lines changed

6 files changed

+55
-55
lines changed

src/mock_vws/_flask_server/vwq.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
)
1919
from mock_vws._query_validators import run_query_validators
2020
from mock_vws._query_validators.exceptions import (
21-
ValidatorException,
21+
ValidatorError,
2222
)
2323
from mock_vws.database import VuforiaDatabase
2424
from mock_vws.image_matchers import (
@@ -100,8 +100,8 @@ def set_terminate_wsgi_input() -> None:
100100
request.environ["wsgi.input_terminated"] = True
101101

102102

103-
@CLOUDRECO_FLASK_APP.errorhandler(ValidatorException)
104-
def handle_exceptions(exc: ValidatorException) -> Response:
103+
@CLOUDRECO_FLASK_APP.errorhandler(ValidatorError)
104+
def handle_exceptions(exc: ValidatorError) -> Response:
105105
"""
106106
Return the error response associated with the given exception.
107107
"""

src/mock_vws/_flask_server/vws.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Fail,
2626
TargetStatusNotSuccess,
2727
TargetStatusProcessing,
28-
ValidatorException,
28+
ValidatorError,
2929
)
3030
from mock_vws.database import VuforiaDatabase
3131
from mock_vws.image_matchers import (
@@ -131,8 +131,8 @@ def validate_request() -> None:
131131
)
132132

133133

134-
@VWS_FLASK_APP.errorhandler(ValidatorException)
135-
def handle_exceptions(exc: ValidatorException) -> Response:
134+
@VWS_FLASK_APP.errorhandler(ValidatorError)
135+
def handle_exceptions(exc: ValidatorError) -> Response:
136136
"""
137137
Return the error response associated with the given exception.
138138
"""

src/mock_vws/_query_validators/exceptions.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from mock_vws._mock_common import json_dump
1212

1313

14-
class ValidatorException(Exception):
14+
class ValidatorError(Exception):
1515
"""
1616
A base class for exceptions thrown from mock Vuforia cloud recognition
1717
client endpoints.
@@ -22,7 +22,7 @@ class ValidatorException(Exception):
2222
headers: dict[str, str]
2323

2424

25-
class DateHeaderNotGiven(ValidatorException):
25+
class DateHeaderNotGiven(ValidatorError):
2626
"""
2727
Exception raised when a date header is not given.
2828
"""
@@ -48,7 +48,7 @@ def __init__(self) -> None:
4848
}
4949

5050

51-
class DateFormatNotValid(ValidatorException):
51+
class DateFormatNotValid(ValidatorError):
5252
"""
5353
Exception raised when the date format is not valid.
5454
"""
@@ -75,7 +75,7 @@ def __init__(self) -> None:
7575
}
7676

7777

78-
class RequestTimeTooSkewed(ValidatorException):
78+
class RequestTimeTooSkewed(ValidatorError):
7979
"""
8080
Exception raised when Vuforia returns a response with a result code
8181
'RequestTimeTooSkewed'.
@@ -106,7 +106,7 @@ def __init__(self) -> None:
106106
}
107107

108108

109-
class BadImage(ValidatorException):
109+
class BadImage(ValidatorError):
110110
"""
111111
Exception raised when Vuforia returns a response with a result code
112112
'BadImage'.
@@ -144,7 +144,7 @@ def __init__(self) -> None:
144144
}
145145

146146

147-
class AuthenticationFailure(ValidatorException):
147+
class AuthenticationFailure(ValidatorError):
148148
"""
149149
Exception raised when Vuforia returns a response with a result code
150150
'AuthenticationFailure'.
@@ -182,7 +182,7 @@ def __init__(self) -> None:
182182
}
183183

184184

185-
class AuthenticationFailureGoodFormatting(ValidatorException):
185+
class AuthenticationFailureGoodFormatting(ValidatorError):
186186
"""
187187
Exception raised when Vuforia returns a response with a result code
188188
'AuthenticationFailure' with a standard JSON formatting.
@@ -215,7 +215,7 @@ def __init__(self) -> None:
215215
}
216216

217217

218-
class ImageNotGiven(ValidatorException):
218+
class ImageNotGiven(ValidatorError):
219219
"""
220220
Exception raised when an image is not given.
221221
"""
@@ -242,7 +242,7 @@ def __init__(self) -> None:
242242
}
243243

244244

245-
class AuthHeaderMissing(ValidatorException):
245+
class AuthHeaderMissing(ValidatorError):
246246
"""
247247
Exception raised when an auth header is not given.
248248
"""
@@ -270,7 +270,7 @@ def __init__(self) -> None:
270270
}
271271

272272

273-
class MalformedAuthHeader(ValidatorException):
273+
class MalformedAuthHeader(ValidatorError):
274274
"""
275275
Exception raised when an auth header is not given.
276276
"""
@@ -299,7 +299,7 @@ def __init__(self) -> None:
299299
}
300300

301301

302-
class UnknownParameters(ValidatorException):
302+
class UnknownParameters(ValidatorError):
303303
"""
304304
Exception raised when unknown parameters are given.
305305
"""
@@ -326,7 +326,7 @@ def __init__(self) -> None:
326326
}
327327

328328

329-
class InactiveProject(ValidatorException):
329+
class InactiveProject(ValidatorError):
330330
"""
331331
Exception raised when Vuforia returns a response with a result code
332332
'InactiveProject'.
@@ -363,7 +363,7 @@ def __init__(self) -> None:
363363
}
364364

365365

366-
class InvalidMaxNumResults(ValidatorException):
366+
class InvalidMaxNumResults(ValidatorError):
367367
"""
368368
Exception raised when an invalid value is given as the
369369
"max_num_results" field.
@@ -395,7 +395,7 @@ def __init__(self, given_value: str) -> None:
395395
}
396396

397397

398-
class MaxNumResultsOutOfRange(ValidatorException):
398+
class MaxNumResultsOutOfRange(ValidatorError):
399399
"""
400400
Exception raised when an integer value is given as the "max_num_results"
401401
field which is out of range.
@@ -427,7 +427,7 @@ def __init__(self, given_value: str) -> None:
427427
}
428428

429429

430-
class InvalidIncludeTargetData(ValidatorException):
430+
class InvalidIncludeTargetData(ValidatorError):
431431
"""
432432
Exception raised when an invalid value is given as the
433433
"include_target_data" field.
@@ -461,7 +461,7 @@ def __init__(self, given_value: str) -> None:
461461
}
462462

463463

464-
class UnsupportedMediaType(ValidatorException):
464+
class UnsupportedMediaType(ValidatorError):
465465
"""
466466
Exception raised when no boundary is found for multipart data.
467467
"""
@@ -487,7 +487,7 @@ def __init__(self) -> None:
487487
}
488488

489489

490-
class InvalidAcceptHeader(ValidatorException):
490+
class InvalidAcceptHeader(ValidatorError):
491491
"""
492492
Exception raised when there is an invalid accept header given.
493493
"""
@@ -513,7 +513,7 @@ def __init__(self) -> None:
513513
}
514514

515515

516-
class NoBoundaryFound(ValidatorException):
516+
class NoBoundaryFound(ValidatorError):
517517
"""
518518
Exception raised when an invalid media type is given.
519519
"""
@@ -543,7 +543,7 @@ def __init__(self) -> None:
543543
}
544544

545545

546-
class ContentLengthHeaderTooLarge(ValidatorException):
546+
class ContentLengthHeaderTooLarge(ValidatorError):
547547
"""
548548
Exception raised when the given content length header is too large.
549549
"""
@@ -566,7 +566,7 @@ def __init__(self) -> None: # pragma: no cover
566566
}
567567

568568

569-
class ContentLengthHeaderNotInt(ValidatorException):
569+
class ContentLengthHeaderNotInt(ValidatorError):
570570
"""
571571
Exception raised when the given content length header is not an integer.
572572
"""
@@ -588,7 +588,7 @@ def __init__(self) -> None:
588588
}
589589

590590

591-
class RequestEntityTooLarge(ValidatorException):
591+
class RequestEntityTooLarge(ValidatorError):
592592
"""
593593
Exception raised when the given image file size is too large.
594594
"""
@@ -627,7 +627,7 @@ def __init__(self) -> None: # pragma: no cover
627627
}
628628

629629

630-
class NoContentType(ValidatorException):
630+
class NoContentType(ValidatorError):
631631
"""
632632
Exception raised when a content type is either not given or is empty.
633633
"""

src/mock_vws/_requests_mock_server/mock_web_query_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818
from mock_vws._query_validators import run_query_validators
1919
from mock_vws._query_validators.exceptions import (
20-
ValidatorException,
20+
ValidatorError,
2121
)
2222

2323
if TYPE_CHECKING:
@@ -107,7 +107,7 @@ def query(self, request: Request, context: Context) -> str:
107107
request_method=request.method,
108108
databases=self._target_manager.databases,
109109
)
110-
except ValidatorException as exc:
110+
except ValidatorError as exc:
111111
context.headers = exc.headers
112112
context.status_code = exc.status_code
113113
return exc.response_text

src/mock_vws/_requests_mock_server/mock_web_services_api.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
Fail,
2525
TargetStatusNotSuccess,
2626
TargetStatusProcessing,
27-
ValidatorException,
27+
ValidatorError,
2828
)
2929
from mock_vws.target import Target
3030

@@ -133,7 +133,7 @@ def add_target(self, request: Request, context: Context) -> str:
133133
request_path=request.path,
134134
databases=self._target_manager.databases,
135135
)
136-
except ValidatorException as exc:
136+
except ValidatorError as exc:
137137
context.headers = exc.headers
138138
context.status_code = exc.status_code
139139
return exc.response_text
@@ -206,7 +206,7 @@ def delete_target(self, request: Request, context: Context) -> str:
206206
request_path=request.path,
207207
databases=self._target_manager.databases,
208208
)
209-
except ValidatorException as exc:
209+
except ValidatorError as exc:
210210
context.headers = exc.headers
211211
context.status_code = exc.status_code
212212
return exc.response_text
@@ -269,7 +269,7 @@ def database_summary(self, request: Request, context: Context) -> str:
269269
request_path=request.path,
270270
databases=self._target_manager.databases,
271271
)
272-
except ValidatorException as exc:
272+
except ValidatorError as exc:
273273
context.headers = exc.headers
274274
context.status_code = exc.status_code
275275
return exc.response_text
@@ -331,7 +331,7 @@ def target_list(self, request: Request, context: Context) -> str:
331331
request_path=request.path,
332332
databases=self._target_manager.databases,
333333
)
334-
except ValidatorException as exc:
334+
except ValidatorError as exc:
335335
context.headers = exc.headers
336336
context.status_code = exc.status_code
337337
return exc.response_text
@@ -387,7 +387,7 @@ def get_target(self, request: Request, context: Context) -> str:
387387
request_path=request.path,
388388
databases=self._target_manager.databases,
389389
)
390-
except ValidatorException as exc:
390+
except ValidatorError as exc:
391391
context.headers = exc.headers
392392
context.status_code = exc.status_code
393393
return exc.response_text
@@ -451,7 +451,7 @@ def get_duplicates(self, request: Request, context: Context) -> str:
451451
request_path=request.path,
452452
databases=self._target_manager.databases,
453453
)
454-
except ValidatorException as exc:
454+
except ValidatorError as exc:
455455
context.headers = exc.headers
456456
context.status_code = exc.status_code
457457
return exc.response_text
@@ -521,7 +521,7 @@ def update_target(self, request: Request, context: Context) -> str:
521521
request_path=request.path,
522522
databases=self._target_manager.databases,
523523
)
524-
except ValidatorException as exc:
524+
except ValidatorError as exc:
525525
context.headers = exc.headers
526526
context.status_code = exc.status_code
527527
return exc.response_text
@@ -626,7 +626,7 @@ def target_summary(self, request: Request, context: Context) -> str:
626626
request_path=request.path,
627627
databases=self._target_manager.databases,
628628
)
629-
except ValidatorException as exc:
629+
except ValidatorError as exc:
630630
context.headers = exc.headers
631631
context.status_code = exc.status_code
632632
return exc.response_text

0 commit comments

Comments
 (0)