Skip to content
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

ui: handle errors from unimplemented services #18020

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/18020.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Fixed error handling for cross-region requests when the receiving region does not implement the endpoint being requested
```
4 changes: 3 additions & 1 deletion ui/app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export default class ApplicationAdapter extends RESTAdapter {
return super.findAll(...arguments).catch((error) => {
const errorCodes = codesForError(error);

const isNotImplemented = errorCodes.includes('501');
const isNotImplemented =
errorCodes.includes('501') ||
error.message.includes("rpc: can't find service");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for reviewers: this error comes from the stdlib: https://cs.opensource.google/go/go/+/refs/tags/go1.20.6:src/net/rpc/server.go;l=613

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a change a UI dev* might short-circuit this with an isNotImplemented handler in the future that just checks for 501 in a specific adapter layer. I don't think it's likely (we've always used super so far to inherit from this one) but it would be safer if we eventually returned 501s for these. I don't know if changing the stdlib is at all a likelihood, though!

*it could be me! I forget stuff all the time!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need to wrap the RPC error to change the status code. Not a big problem, but I suspect there may be lots of code to change 😅

I opened #18050 to track this.


if (isNotImplemented) {
return [];
Expand Down
Loading