GhostSharp
GhostSharp copied to clipboard
More detailed error messages
The RestResponse.Content field looks something like this when it has an error in it, when it's returned in GhostAPI.cs. I could modify the error I return to take some of that data into account, to make errors more meaningful...
{
"errors": [{
"message": "Validation error, cannot save post.",
"context": "Validation failed for 'posts'",
"type": "ValidationError",
"details": [{
"keyword": "additionalProperties",
"dataPath": "",
"schemaPath": "#/additionalProperties",
"params": {
"additionalProperty": "Posts"
},
"message": "should NOT have additional properties"
},
{
"keyword": "required",
"dataPath": "",
"schemaPath": "#/required",
"params": {
"missingProperty": "posts"
},
"message": "should have required property 'posts'"
}
],
"property": "posts",
"help": null,
"code": null,
"id": "b50a7fd0-500a-11e9-a8e0-472301ed00b2"
}]
}
{
"errors": [{
"message": "Validation error, cannot edit post.",
"context": "Validation failed for 'posts[0]'",
"type": "ValidationError",
"details": [{
"keyword": "additionalProperties",
"dataPath": ".posts[0]",
"schemaPath": "#/additionalProperties",
"params": {
"additionalProperty": "uuid"
},
"message": "should NOT have additional properties"
}, {
"keyword": "additionalProperties",
"dataPath": ".posts[0]",
"schemaPath": "#/additionalProperties",
"params": {
"additionalProperty": "comment_id"
},
"message": "should NOT have additional properties"
}],
"property": "posts[0]",
"help": null,
"code": null,
"id": "1ba48e70-5155-11e9-be0e-1702dc9d57c3"
}]
}