MichalLytek / class-transformer-validator

A simple plugin for class-transformer and class-validator which combines them in a nice and programmer-friendly API.
MIT License
200 stars 19 forks source link

Added appendError utility function #29

Closed Deviad closed 4 years ago

Deviad commented 4 years ago

At least in Koa, I cannot get the error messages straight in a message field. Therefore I created this function to extract the error messages from "constraints" array.

Here is a repl.it: https://repl.it/@Deviad/AppendError#index.js The object in the repl is what I get inside err within catch(err){} when using koa.

MichalLytek commented 4 years ago

I cannot get the error messages straight in a message field. Therefore I created this function to extract the error messages from "constraints" array.

I appreciate your PR although I think it should be posted against the main class-validator repository, not this one as it's only a simple plugin, a wrapper around that two libraries.

Your use case is also really specific so maybe you should make it a separate npm package so all koa users could use that.

So I had to close this one 🔒