You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constmyCustomFn=(value,helpers)=>{// If condition is matched I want to set both code 'my.error.code' and message inside this myCustomFn// but helpers.error() does not allow setting message and helpers.message() does not allow setting code other then "custom"// and I do not want in many places in code use .custom() with combination .messages() because messages will be repetitive:// .custom(myCustomFn).messages({ 'my.error.code' : 'My error message' })// I tried to use helpers.prefs.messages['my.error.code'] = 'My error message' but it causes errorif(.........)returnhelpers.error('my.error.code');returnvalue;};joi.object({
.........
}).xor(.......).custom(myCustomFn)
The text was updated successfully, but these errors were encountered:
nolimitdev
changed the title
Set both custom error code and custom message using custom() at once
Set both custom error code and custom message inside custom function
Dec 30, 2024
Runtime
n/a
Runtime version
n/a
Module version
n/a
Used with
No response
Any other relevant information
No response
How can we help?
The text was updated successfully, but these errors were encountered: