Skip to content

Commit df92d5a

Browse files
committed
Add general exception catch to nested validation
1 parent 709d8e0 commit df92d5a

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

flask_inputfilter/_input_filter.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ cdef dict _INTERNED_STRINGS = {
5555
"required": sys.intern("required"),
5656
"steps": sys.intern("steps"),
5757
"validators": sys.intern("validators"),
58+
"HEAD": sys.intern("HEAD"),
59+
"OPTIONS": sys.intern("OPTIONS"),
5860
}
5961

6062
T = TypeVar("T")

flask_inputfilter/include/helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ class StringConstants {
9999
constants["required"] = "required";
100100
constants["steps"] = "steps";
101101
constants["validators"] = "validators";
102+
constants["HEAD"] = "HEAD";
103+
constants["OPTIONS"] = "OPTIONS";
102104
}
103105

104106
public:

flask_inputfilter/input_filter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
"required": sys.intern("required"),
3939
"steps": sys.intern("steps"),
4040
"validators": sys.intern("validators"),
41+
"HEAD": sys.intern("HEAD"),
42+
"OPTIONS": sys.intern("OPTIONS"),
4143
}
4244

4345

flask_inputfilter/mixins/data_mixin/_data_mixin.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ from libcpp.vector cimport vector
1414
from libcpp.string cimport string
1515
from libcpp.algorithm cimport find
1616

17-
DEF LARGE_DATASET_THRESHOLD = 100
17+
cdef int LARGE_DATASET_THRESHOLD = 10
1818

1919

2020
cdef class DataMixin:

flask_inputfilter/mixins/validation_mixin/validation_mixin.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ def apply_nested_input_filter(
285285
raise ValidationError(
286286
f"Nested validation failed for field '{field_name}': {e!s}"
287287
) from e
288+
except Exception as e:
289+
raise ValidationError(
290+
f"Unexpected error during nested validation for field "
291+
f"'{field_name}': {e!s}"
292+
) from e
288293

289294
@staticmethod
290295
def get_field_value(

0 commit comments

Comments
 (0)