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
Is your feature request related to a problem? Please describe.
I would like to create custom errors, and return they on validate, without the need to call error.message every time.
Describe the solution you'd like
Make prompt.validate accept Error instances as return type. Then internally prompt.validate could verify if the result is a Error instance, then call error.message.
Example:
interfaceTextOptions{message: string;
...
validate?: (value: string)=>string|Error|void;}awaitp.text({message: 'Type your alias key:',validate: value=>{if(value.length!==1){returnnewInvalidParamError('alias','max length is 1')}}})
Describe alternatives you've considered
N/A
Additional context
I'd be happy to contribute this.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I would like to create custom errors, and return they on validate, without the need to call
error.message
every time.Describe the solution you'd like
Make
prompt.validate
acceptError
instances as return type. Then internallyprompt.validate
could verify if the result is aError
instance, then callerror.message
.Example:
Describe alternatives you've considered
N/A
Additional context
I'd be happy to contribute this.
The text was updated successfully, but these errors were encountered: