Hi,
I am working on a class project that is a cheese API but I am running into
some issues.
Does anyone have any suggestions for how to handle non-validation errors.
Swagger handles my errors if something is omitted from the search or the
type is wrong (i.e. leaving out cheese name or having a number for a cheese
name) which is great! However I am working on a post route and I do not
want multiple cheeses added to the database if they already exist. Once the
cheeses already in the db get to where I want them to go and would normally
do a res.status(400).send('cheese already in db') I get errors and the
statuses don't send. I have that it produces text/plain at the top of the
page but that doesn't help. My hacky solution was to send a JSON string.
Any other thoughts?
Source code:
```
.then((namesOfTheCheeses) => {
if (namesOfTheCheeses.indexOf(name) >= 0) {
res.status(400).json('This Cheese is in the Database')
}
else {
```
Thanks,
Daniel
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.