-
Notifications
You must be signed in to change notification settings - Fork 96
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
Validation errors return an HTTP 500 Error #56
Comments
I think I understand. I removed the error handling from import path from 'path';
import notFound from './not-found-handler';
import { handler as error } from 'feathers-errors';
import logger from './logger';
export default function() {
const app = this;
// Add your custom middleware here. Remember, that
// just like Express the order matters, so error
// handling middleware should go last.
app.use(notFound())
.use(logger(app))
// .use(error());
// This simple error handler was added
app.use(function(error, req, res, next){
res.json(error);
});
} Now the error displayed in the proper format: It works, but I'm not sure I did it right. |
You need to set the The error page should probably show a better message though. You get a 400 code but it shows up as a 500 error page. It should probably just say something like "General error". |
Thank you @daffl. I forgot about this header! :) |
In User model, I changed
username
attribute tounique
andrequired
.When I try to send a POST request to
http://localhost:3030/users
with empty body parameters, I get a 500 Internal Server Error.However, I see in the console:
In documents written that I'll get a nice error handling out of the box. But this is not the case.
Maybe I'm doing something wrong?
How to check the uniqueness of user name in another way?
The text was updated successfully, but these errors were encountered: