-
Notifications
You must be signed in to change notification settings - Fork 37
Update device error model #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update device error model #232
Conversation
|
@fernandopradocabrillo Agree with you to keep it but in order to be explicit the code should not be: |
|
Hi @fernandopradocabrillo
Following points are open:
|
I'm not sure, I see that in geofencing it is also SUBSCRIPTION_MISMATCH: https://github.com/camaraproject/DeviceLocation/blob/main/code/API_definitions/geofencing-subscriptions.yaml#L1166 do you know if there is any conversation right now in commonalities regarding the errors in subscriptions? |
|
@fernandopradocabrillo would it be possible to cover the 2 new APIs here as well? 🙂 (connected-network-type-subscriptions is still to be merged) |
…into update-device-error-model
yeah and I won't charge extra |
|
@camaraproject/device-status_maintainers shouldn't the POST /subscription endpoint also have the 404 IDENTIFIER_NOT_FOUND error? |
|
@camaraproject/device-status_maintainers connected network subscriptions aligned. What strategy should we follow for non-mandatory errors? What errors do you think we should keep/remove? |
You mean for missing phone number? For that case I think 422 - MISSING_IDENTIFIER should be returned |
|
For the subscription APIs there is quite much overlapping with #250. Maybe we should work on the subscription APIs there and only on the retrieve APIs here. @fernandopradocabrillo what do you think? |
@akoshunyadi agree, it made sense earlier but now there are too many conflicts, I'll remove the subscription changes and leave only the retrieve yamls |
bigludo7
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fernandopradocabrillo - look good for me except that we do not have the 'new' 429 message. Let me know if you want to handle in this one or in other PR.
Should be (as defined in Defined in Commonalities camaraproject/Commonalities#390 )
examples:
GENERIC_429_QUOTA_EXCEEDED:
description: Request is rejected due to exceeding a business quota limit
value:
status: 429
code: QUOTA_EXCEEDED
message: Out of resource quota.
GENERIC_429_TOO_MANY_REQUESTS:
description: Access to the API has been temporarily blocked due to rate or spike arrest limits being reached
value:
status: 429
code: TOO_MANY_REQUESTS
message: Rate limit reached.
| enum: | ||
| - QUOTA_EXCEEDED | ||
| - TOO_MANY_REQUESTS | ||
| examples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to align message fieldd and description for Error 429
Defined in Commonalities camaraproject/Commonalities#390
examples:
GENERIC_429_QUOTA_EXCEEDED:
description: Request is rejected due to exceeding a business quota limit
value:
status: 429
code: QUOTA_EXCEEDED
message: Out of resource quota.
GENERIC_429_TOO_MANY_REQUESTS:
description: Access to the API has been temporarily blocked due to rate or spike arrest limits being reached
value:
status: 429
code: TOO_MANY_REQUESTS
message: Rate limit reached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks!
| code: | ||
| enum: | ||
| - QUOTA_EXCEEDED | ||
| - TOO_MANY_REQUESTS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same - probably easy to align for new 429 message.
| - 429 | ||
| code: | ||
| enum: | ||
| - QUOTA_EXCEEDED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
| - 401 | ||
| code: | ||
| enum: | ||
| - UNAUTHENTICATED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an open issue in Commonalities to discuss the future of UNAUTHENTICATED / AUTHENTICATION_REQUIRED. I'm happy just to have UNAUTHENTICATED for now, but let's not forget to review again after Commonalities have made a decision.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also happy with UNAUTHENTICATED
|
@fernandopradocabrillo Can you sync your fork and resolve any outstanding conflicts first before I continue my review? Thanks. |
I was trying to remove all the changes I included for the subscriptions since a new PR was raised duplicating them and including new ones, but it has been a mess so yeah, I'll simply pull the changes from main and try to sync |
…into update-device-error-model
maybe we can move this discussion to PR #250 and include the error there if it is needed. In theory it could happen that in a 2-legged scenario, the client specifies a valid msisdn that doesn't belong to the operator |
| value: | ||
| status: 422 | ||
| code: UNABLE_TO_PROVIDE_REACHABILITY_STATUS | ||
| message: Network issue - Unable to provide reachability status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this case really a 422 Unprocessable Content ? If the request is incorrect, we should tell which parameter is wrong. But this one looks like a 5xx error, maybe 503, to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this error for when it is not possible to return the real-time status of the device? I'm not sure it should be a 5XX, that would be telling the client to not retry the request with the same data, but this might be a temporary error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if only the referenced device is affected, not generally, then I would add the "device" to the case. e.g.
GENERIC_422_UNABLE_TO_PROVIDE_REACHABILITY_STATUS_FOR_DEVICE:
code: UNABLE_TO_PROVIDE_REACHABILITY_STATUS_FOR_DEVICE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bigludo7 @eric-murray @sachinvodafone Do we need this service specific code at all? Is there a use case for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this should be a 503. That assumes that the error is temporary and that normally a status can be returned for the device.
If there are devices for which a reachability status can never be returned, that is 422 SERVICE_NOT_APPLICABLE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with @eric-murray proposal and not introduce a specific code.
Perhaps worth to ad a note in commonalities as 503 definition is "the server is currently unable to handle the request due to a temporary overload or scheduled maintenance" - here we have one additional case - we're not able to provide the service for a device we're supposed to be able to provide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bigludo7
Yes, agree. We can explicitly include 503 in the YAML with the "network issue" message as an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated accordingly
| value: | ||
| status: 422 | ||
| code: UNABLE_TO_PROVIDE_ROAMING_STATUS | ||
| message: Network issue - Unable to provide roaming status |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: Is this case really a 422 Unprocessable Content ? If the request is incorrect, we should tell which parameter is wrong. But this one looks like a 5xx error, maybe 503, to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above:
- Temporary problem: 503
- Permanent problem: 422 SERVICE_NOT_APPLICABLE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| $ref: "#/components/responses/Generic503" | ||
| $ref: "#/components/responses/Generic422" | ||
| "429": | ||
| $ref: "#/components/responses/Generic429" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API doesn't have 406 and 415 as the other 2. I think for consistency reason the responses should be same for all 3 APIs. I'm not sure if we need those though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the tendency is to remove unused errors, maybe what we have to do is delete them from the other two apis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. We should remove 415 and 406 from all APIs. Neither is required to be documented, and their use in these APIs is nothing out of the ordinary for those status codes, and not related to the use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree as well - we should remove 415 & 406.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
maxl2287
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@eric-murray @sachinvodafone @bigludo7 as this PR is blocking the test-PRs, could you be so kind and review this again please? Many thanks in advance. |
eric-murray
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any scenario that would result in 404 NOT_FOUND, but we can revisit that at a later date
bigludo7
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@akoshunyadi @eric-murray can we merge this now? Wdyt? |
|
Yes, we should merge this now, and then review other PRs. I can merge if @akoshunyadi is unavailable |
|
Thanks! :) |
What type of PR is this?
Add one of the following kinds:
What this PR does / why we need it:
Align error model with Commonalities for meta Spring25
Which issue(s) this PR fixes:
Fixes #230
Special notes for reviewers:
In the subscriptions APIs there is one error that I'm not sure if we have to update or not.
It looks like it is the equivalent to
403 INVALID_TOKEN_CONTEXT. It may make sense to keep it since thedeviceobject is required when creating the subscription, regardless of the token type. I tend to think we should keep it.