Closed (fixed)
Project:
JSON:API
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
17 Jan 2017 at 09:05 UTC
Updated:
8 Feb 2018 at 10:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dawehnerHere is a rough start. Do you believe we should support potential multiple sources of errors on the longrun? I guess for now, as we throw exceptions, we can't really.
Comment #3
e0ipsoThanks @dawehner! This is definitely the path we want to move this forward.
Some comments.
The
newstatements do not match the class constructor arguments.There seems to be quite some duplication around this code.
What if we had a static method in
EntityAccessDeniedHttpExceptionthat did all this?Something like:
In that scenario we could turn
addErrorinto a protected method to reduce API surface.Copy & Pasta
This approach seems a bit brittle. Why not an array of errors keyed by entity ID.
That way the arrays cannot get out of sync with each other.
What's the gain on returning self instead of not returning?
Comment #4
dawehnerI thought about that ... there is one small problem, the backtrace would be a bit more confusing than on a normal exception. The backtrace will be created where the new call is done. Do we care much about that?
Well, theoretically we could chain call, but I couldn't care less :)
Comment #5
dawehnerComment #8
dawehnerOne remaining question is: Do we really want to pretend we can support multiple exception. To be honest I'm not convinced by that.
Comment #10
dawehnerI removed the "support" for multiple exceptions now. The test coverage got also improved.
Comment #11
e0ipsoThis should be enforced by
protected $supportedInterfaceOrClass = EntityAccessDeniedHttpException::class;. However I'm good keeping this in case anyone changes the applies logic when extending this.Assigning to myself to add a test for a collection that includes 403. I also did a needed reroll.
Comment #12
e0ipsoComment #13
e0ipsoChanges:
Comment #14
e0ipsoUgh! I sent the interdiff with the wrong extension. Now the testbot is going to choke. Is there any way to cancel a queued test?
Comment #15
e0ipsoComment #16
e0ipsoComment #18
dawehnerThank you @e0ipso!
Comment #20
wim leersThis didn't follow the JSON API spec in one area, being fixed in #2943176: Spec Compliance: when error object 'id' key exists, it contains the individual resource URI, instead of "a unique identifier for this particular occurrence of the problem".