sealcode / sealious

An extensible, declarative node framework
25 stars 2 forks source link

Trello#better rest error output #251

Closed adwydman closed 8 years ago

adwydman commented 8 years ago

Console output:

13:13:53.208 - error:   PATCH /api/v1/pet/rvv1gcncns
            from: 127.0.0.1, mime: multipart/form-data
            result: failed - There are problems with some of the provided values: 
 * species - This species of animal is not accepted
 * age - Value `sssss` is not a int number format.

Error: There are problems with some of the provided values: 
 * species - This species of animal is not accepted
 * age - Value `sssss` is not a int number format.

    at new SealiousErrors.Error (/home/adrian/Documents/Sealious/sealious/lib/response/error.js:6:12)

Http client output:

{
  "data": {
    "species": "This species of animal is not accepted",
    "age": "Value `sssss` is not a int number format."
  },
  "is_error": true,
  "type": "validation",
  "status_message": "There are problems with some of the provided values: \n * species - This species of animal is not accepted\n * age - Value `sssss` is not a int number format.\n"
}
adwydman commented 8 years ago

There are some tests that are failing, that are not present in 0.7.

kuba-orlik commented 8 years ago

As we discussed IRL - a better solution to this problem is for the logger itself to always format and display error.data (if present), not only error.message :)

kuba-orlik commented 8 years ago

(as error.data contains all the crucial info)

adwydman commented 8 years ago

www-server PR: https://github.com/Sealious/sealious-www-server/pull/43