jef-sachsen / verver-server

GNU Affero General Public License v3.0
3 stars 0 forks source link

Api Returns statuts 500 (internal server error) if a validation fails. #12

Open leoek opened 6 years ago

leoek commented 6 years ago

actual:

{
  "timestamp" : "2018-04-27T02:14:12.161+0000",
  "status" : 500,
  "error" : "Internal Server Error",
  "message" : "Validation failed for classes [de.ul.swtp.modules.contactmanagement.Contact] during persist time for groups [javax.validation.groups.Default, ]\nList of constraint violations:[\n\tConstraintViolationImpl{interpolatedMessage='must not be blank', propertyPath=address, rootBeanClass=class de.ul.swtp.modules.contactmanagement.Contact, messageTemplate='{javax.validation.constraints.NotBlank.message}'}\n\tConstraintViolationImpl{interpolatedMessage='must not be blank', propertyPath=lastName, rootBeanClass=class de.ul.swtp.modules.contactmanagement.Contact, messageTemplate='{javax.validation.constraints.NotBlank.message}'}\n\tConstraintViolationImpl{interpolatedMessage='must not be blank', propertyPath=firstName, rootBeanClass=class de.ul.swtp.modules.contactmanagement.Contact, messageTemplate='{javax.validation.constraints.NotBlank.message}'}\n]",
  "path" : "/contacts"
}

expected: status 400 and a useful message

request to reproduce:

curl 'https://api.swt.leoek.eu/contacts?' -H 'origin: http://localhost:3000' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9,de-DE;q=0.8,de;q=0.7,fr-FR;q=0.6,fr;q=0.5' -H 'authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbkB0ZXN0LmNvbSIsImV4cCI6MTUyNTM4MjU4NCwiaWF0IjoxNTI0Nzc3Nzg0fQ.uN1IvTFpCkhR4gipepXs2jiN92lOyh5F1fSehRMm0TUFuamvtWfoDV3GpfPcjYR_4zEbRd1VL6XBHjEZRP3FVw' -H 'pragma: no-cache' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36' -H 'content-type: application/json; charset=utf-8' -H 'accept: */*' -H 'cache-control: no-cache' -H 'authority: api.swt.leoek.eu' -H 'referer: http://localhost:3000/contact/create' -H 'dnt: 1' --data-binary '{}' --compressed