@@ -275,7 +275,7 @@ def __init__(self, wrong_value, condition, **kwargs):
275275 ```
276276
277277 Note: if users wish to wrap an *existing* function (such as a lambda or mini lambda) with a Failure raiser, then
278- they should subclass `WrappingFailure ` instead of `Failure`. See `WrappingFailure ` for details.
278+ they should subclass `ValidationFailed ` instead of `Failure`. See `ValidationFailed ` for details.
279279 """
280280
281281 def __init__ (self ,
@@ -334,7 +334,7 @@ def get_details(self):
334334 return 'Wrong value: %s' % repr (self .wrong_value )
335335
336336
337- class WrappingFailure (Failure ):
337+ class ValidationFailed (Failure ):
338338 """
339339 Represents a Failure associated with a wrapped validation function. It contains additional details about which
340340 validation function it was, and what was the outcome.
@@ -344,7 +344,7 @@ class WrappingFailure(Failure):
344344
345345 * either use the syntax `(<wrapped_callable>, <help_msg>)` when defining validation functions, or explicitly call
346346 `failure_raiser(<wrapped_callable>, help_msg=<help_msg>)`. Both are equivalent and will create instances of
347- `WrappingFailure ` with the provided help message when the wrapped callable fails.
347+ `ValidationFailed ` with the provided help message when the wrapped callable fails.
348348
349349 * or subclass it explicitly (recommended) and then use the syntax `(<callable>, <subclass>)` or
350350 `failure_raiser(<wrapped_callable>, failure_type=<subclass>)`. Both are equivalent and will create instances of
@@ -355,7 +355,7 @@ class WrappingFailure(Failure):
355355 providing details about the failure is to override the 'help_msg' field:
356356
357357 ```python
358- class SurfaceNotInValidRange(WrappingFailure ):
358+ class SurfaceNotInValidRange(ValidationFailed ):
359359 help_msg = 'Surface should be a positive number less than 10000 (square meter)'
360360 ```
361361
@@ -370,7 +370,7 @@ def __init__(self,
370370 help_msg = None , # type: str
371371 ** kw_context_args ):
372372 """
373- Creates a WrappingFailure associated with failed validation of `wrong_value` by `wrapped_func`. Additional
373+ Creates a ValidationFailed associated with failed validation of `wrong_value` by `wrapped_func`. Additional
374374 details about the validation outcome (result or exception) can be provided in validation_outcome.
375375
376376 Contextual information may be provided as keyword arguments, and will be stored as fields in the created
@@ -396,7 +396,7 @@ def __init__(self,
396396 self .validation_outcome = validation_outcome
397397
398398 # call super constructor
399- super (WrappingFailure , self ).__init__ (wrong_value = wrong_value , help_msg = help_msg , ** kw_context_args )
399+ super (ValidationFailed , self ).__init__ (wrong_value = wrong_value , help_msg = help_msg , ** kw_context_args )
400400
401401 # automatically set the exception as the cause, so that we can forget to "raise from"
402402 if isinstance (validation_outcome , Exception ):
@@ -431,8 +431,8 @@ def get_context_for_help_msgs(self, context_dict):
431431
432432
433433def failure_raiser (validation_callable , # type: ValidationCallableOrLambda
434- failure_type = None , # type: Type[WrappingFailure]
435434 help_msg = None , # type: str
435+ failure_type = None , # type: Type[ValidationFailed]
436436 ** kw_context_args ):
437437 # type: (...) -> ValidationCallable
438438 """
@@ -469,7 +469,7 @@ def raiser(x):
469469
470470 # if not result_is_success(res): <= DO NOT REMOVE THIS COMMENT
471471 if (res is not None ) and (res is not True ):
472- typ = failure_type or WrappingFailure
472+ typ = failure_type or ValidationFailed
473473 exc = typ (wrapped_func = validation_callable , wrong_value = x , validation_outcome = res ,
474474 help_msg = help_msg , ** kw_context_args )
475475 raise exc
@@ -538,7 +538,7 @@ def _none_rejecter(validation_callable # type: ValidationCallable
538538 # type: (...) -> ValidationCallable
539539 """
540540 Wraps the given validation callable to reject None values. When a None value is received by the wrapper,
541- it is not passed to the validation_callable and instead this function will raise a WrappingFailure . When any other
541+ it is not passed to the validation_callable and instead this function will raise a ValidationFailed . When any other
542542 value is received the validation_callable is called as usual.
543543
544544 Important: mini-lambda expressions are NOT transformed into function. Indeed this function is internal only
0 commit comments