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.

question: is there a way to get the lowest level constraints messages without building an iterator to get there?

See original GitHub issue

I have ValidateNested and just need the message from the constraint that caused the issue.

Current Code:

function retrieveValidationErrorMessage(err: ValidationError): string {
	if (err.children && err.children.length > 0) {
		return retrieveValidationErrorMessage(err.children[0]);
	} else {
		return Object.keys(err.constraints).map(key => err.constraints[key])[0];
	}
}

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
NoNameProvidedcommented, Apr 13, 2018

You need to traverse down at the moment, but this part will be reworked in the future.

0reactions
github-actions[bot]commented, Sep 8, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ListIterator in Java - DigitalOcean
First, we need to understand about how to get this iterator object. How to get ListIterator? ListIterator<E> listIterator(). It returns a list ...
Read more >
Chapter 6. Creating custom constraints
To create a custom constraint, the following three steps are required: Create a constraint annotation; Implement a validator; Define a default error message...
Read more >
Iterators in Java - GeeksforGeeks
A Java Cursor is an Iterator, which is used to iterate or traverse or retrieve a Collection or Stream object's elements one by...
Read more >
python - How to build a basic iterator? - Stack Overflow
This method raises a StopIteration exception when there are no more value to return, which is implicitly captured by looping constructs to stop...
Read more >
Frequently Asked Questions - GCC, the GNU Compiler Collection
But there's no way to make that work with C++, where much of the library consists of inline functions and templates, which are...
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