question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing Define or Override Error Messages section in docs

See original GitHub issue

The entire section Define or Override Error Messages links to non-existent files.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
robksawyercommented, Sep 16, 2017

For others, I searched the closed issues and found the following related issues.

The following snippet was most helpful.

Overriding error messages is different depending on which plugin you’re using.

  • Using Vanilla Javascript Validation Functions (VJF) you can provide it into the function. The function have to return a boolean or an array with [boolean, string], which the second argument is the error message for the custom functions.
  • Using Json Schema Validation Keywords (SVK) with ajv you can provide error messages for custom keywords, or override existing custom messages.
  • Using Declarative Validation Rules (DVR) you can provide custom error messages for custom registered rules, or you can override the default messages when extending the plugin:
const plugins = {
  dvr: {
    package: validatorjs,
    extend: ($validator) => {
      // here we can access the `validatorjs` instance
      var messages = $validator.getMessages('en');
      messages.required = 'Whoops, :attribute field is required.';
      $validator.setMessages('en', messages);
    },
  },
};

Update: I ended up using the following.

dvr: {
  package: validatorjs,
  extend: ( $validator ) => {
    // @see https://github.com/foxhound87/mobx-react-form/issues/305
    var messages = $validator.getMessages('en');
    messages.confirmed = 'New password confirmation does not match.';
    messages.between = 'Password must be between :min and :max.';
    $validator.setMessages('en', messages);
  }
}
0reactions
foxhound87commented, Feb 20, 2019

I removed the broken links in the documentation. I will not document this since each package has its own implementation. So it’s better to read directly the related documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix common issues in Google Drive
If you're having trouble viewing a file in Google Drive, here's how you can try to fix the issue. 1. Wait and try...
Read more >
Error messages | Document AI - Google Cloud
Learn how to resolve some errors raised by Document AI. This topic discusses errors whose resolutions require more steps than can be easily...
Read more >
Error Messages | Maps JavaScript API - Google Developers
For help on finding error messages, see the section on checking errors in your browser. The following flow will help you troubleshoot the...
Read more >
Error handling - Apollo GraphQL Docs
You can create a custom errors and codes using the graphql package's ... does not modify errors that are sent to Apollo Studio...
Read more >
NetSuite Applications Suite - Error Status Codes
\nPlease go back and change this value to the correct date. DATE_PARAM_REQD. missing date parameter. DATE_PRD_MISMATCH. Your transaction date does not fall ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found