{"action":"closed","issue":{"url":"https://api.github.com/repos/KevinDockx/JsonPatch/issues/14","labels_url":"https://api.github.com/repos/KevinDockx/JsonPatch/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/KevinDockx/JsonPatch/issues/14/comments","events_url":"https://api.github.com/repos/KevinDockx/JsonPatch/issues/14/events","html_url":"https://github.com/KevinDockx/JsonPatch/issues/14","id":57734567,"number":14,"title":"Improve error handling according to spec","user":{"login":"KevinDockx","id":2431035,"avatar_url":"https://avatars.githubusercontent.com/u/2431035?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinDockx","html_url":"https://github.com/KevinDockx","followers_url":"https://api.github.com/users/KevinDockx/followers","following_url":"https://api.github.com/users/KevinDockx/following{/other_user}","gists_url":"https://api.github.com/users/KevinDockx/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinDockx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinDockx/subscriptions","organizations_url":"https://api.github.com/users/KevinDockx/orgs","repos_url":"https://api.github.com/users/KevinDockx/repos","events_url":"https://api.github.com/users/KevinDockx/events{/privacy}","received_events_url":"https://api.github.com/users/KevinDockx/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/KevinDockx/JsonPatch/labels/Feature","name":"Feature","color":"fef2c0"}],"state":"closed","locked":false,"assignee":{"login":"KevinDockx","id":2431035,"avatar_url":"https://avatars.githubusercontent.com/u/2431035?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinDockx","html_url":"https://github.com/KevinDockx","followers_url":"https://api.github.com/users/KevinDockx/followers","following_url":"https://api.github.com/users/KevinDockx/following{/other_user}","gists_url":"https://api.github.com/users/KevinDockx/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinDockx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinDockx/subscriptions","organizations_url":"https://api.github.com/users/KevinDockx/orgs","repos_url":"https://api.github.com/users/KevinDockx/repos","events_url":"https://api.github.com/users/KevinDockx/events{/privacy}","received_events_url":"https://api.github.com/users/KevinDockx/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/KevinDockx/JsonPatch/milestones/2","html_url":"https://github.com/KevinDockx/JsonPatch/milestones/Release%200.9","labels_url":"https://api.github.com/repos/KevinDockx/JsonPatch/milestones/2/labels","id":906977,"number":2,"title":"Release 0.9","description":"","creator":{"login":"KevinDockx","id":2431035,"avatar_url":"https://avatars.githubusercontent.com/u/2431035?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinDockx","html_url":"https://github.com/KevinDockx","followers_url":"https://api.github.com/users/KevinDockx/followers","following_url":"https://api.github.com/users/KevinDockx/following{/other_user}","gists_url":"https://api.github.com/users/KevinDockx/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinDockx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinDockx/subscriptions","organizations_url":"https://api.github.com/users/KevinDockx/orgs","repos_url":"https://api.github.com/users/KevinDockx/repos","events_url":"https://api.github.com/users/KevinDockx/events{/privacy}","received_events_url":"https://api.github.com/users/KevinDockx/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":3,"state":"open","created_at":"2014-12-17T13:32:52Z","updated_at":"2015-06-15T19:06:54Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-02-15T15:51:38Z","updated_at":"2015-06-15T19:06:54Z","closed_at":"2015-06-15T19:06:54Z","body":"=> split from #13 - by @sergkr\r\n\r\nHere's another (potential) consideration: error handling. Error handling probably deserves its own separate issue, as there are a lot of considerations there, but since it will affect the decision of whether to use a custom formatter or not (which we're currently discussing), it's probably worth mentioning a couple things about it here.\r\n\r\nIn the error handling portion of the JSON Patch spec, it refers you to RFC5789, where it says if the user sends a malformed patch document, the server should return an HTTP 400 (Bad Request) response. Ideally, this is something that you should do in your library (so the user of the library shouldn't even have to worry about this). And just to be clear, we're not necessarily talking about just malformed JSON here - they might be sending you valid JSON, but not a valid JSON patch document (e.g., sending an object instead of an array at the root).\r\n\r\nCurrently, if they send a malformed patch document, you're just throwing a JsonPatchException, and I think that's probably fine for now. Even if you go the custom formatter route, you would still have a hard time implementing what the spec says, because you don't have access to the HTTP context (request/response) inside a formatter:\r\n\r\nhttp://aspnetwebstack.codeplex.com/workitem/82\r\n\r\nAt least you don't have easy access - because you actually can get to it as explained here (which is also alluded to in that codeplex issue). But that's something you can only do inside a formatter, as far as I know - so it might be another argument for going the custom formatter route.\r\n\r\nHowever, error handling is a complex topic - the user of the library may want to do error logging, and maybe have full control over the response, in which case you would be doing them a major disfavor if you implement the spec to the letter without making it configurable. If you're going to be helping out with adding JSON Patch support to MVC 6 (I'm aware that's under consideration right now), you may want to touch base with the team on what's the best way to approach this."}}