Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Adding a custom validation error message when defining fields with assert. #3851

Open
2 tasks done
henokmengistu opened this issue Apr 10, 2024 · 0 comments
Open
2 tasks done
Labels
feature New feature or request triage This issue is new

Comments

@henokmengistu
Copy link

Is your feature request related to a problem?

After defining fields with assert when the wrong value is inserted it returns Surreal db error. I want to specify a specific error message for each of the fields submitted that failed the assertion rule.

Describe the solution

When defining a field with a define command there is an option to add an assertion rule with the assert keyword. While this feature works fine there is an issue in specifying a custom error message when the assertion failed when a user created or updated a field.
so if we could add an optional message keyword to specify what the custom error should look like on every asserting it would really be great for the user experience and for not doing things multiple times.

here is an example script:
DEFINE FIELD email ON TABLE user TYPE string ASSERT string::is::email($value) message "Email should be valid!";

Alternative methods

I currently have no alternative methods.

SurrealDB version

1.4.0 for linux on x86_64

Contact Details

henokmengistu5@gmail.com

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@henokmengistu henokmengistu added feature New feature or request triage This issue is new labels Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request triage This issue is new
Projects
None yet
Development

No branches or pull requests

1 participant