Skip to content

Conversation

@allisonschiang
Copy link
Member

See viamrobotics/rdk#5471 for info

@allisonschiang allisonschiang added the safe to test Mark as safe to test label Nov 11, 2025
@aldenh-viam
Copy link
Contributor

Would we potentially miss any useful info with the new conditional? Also would there be any significant performance improvement if we use the errors.Is pattern instead of strings.Contains for these?

@allisonschiang
Copy link
Member Author

Would we potentially miss any useful info with the new conditional? Also would there be any significant performance improvement if we use the errors.Is pattern instead of strings.Contains for these?

For the check if host is offline, no useful info lost because the last message in the SDK/CLI will tell user that host is offline. For the "no active offers for """" I've only ever gotten it when the host was offline (which user will get error for later) but can add another check to confirm the host is actually offline and its not another issue.

Also can update to use errors.Is! Think it will be much faster

@aldenh-viam
Copy link
Contributor

For the check if host is offline, no useful info lost because the last message in the SDK/CLI will tell user that host is offline.

It may not be the best idea to create this kind of linkage unless it's absolutely necessary (counting on the user to behave a certain way).

Also can update to use errors.Is! Think it will be much faster

There are some examples in rdk of using errors.Is for custom errors, which may be helpful. Also https://go.dev/blog/go1.13-errors

Btw you may want to loop in others who are working more closely on the log improvements project to review these PRs instead of me. We've all seen these errors plenty of times, but they would probably have more thoughts on the best way/place to implement these changes.

@viambot viambot removed the safe to test Mark as safe to test label Nov 12, 2025
@allisonschiang
Copy link
Member Author

It may not be the best idea to create this kind of linkage unless it's absolutely necessary (counting on the user to behave a certain way).

thats a fair point, I can just lower it to debug so it doesn't show up on the CLI + users don't get confused by it but its still there

@allisonschiang allisonschiang requested a review from a team November 12, 2025 21:45
@allisonschiang allisonschiang added the safe to test Mark as safe to test label Nov 12, 2025
Copy link
Member

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

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

Nice!

@viambot viambot removed the safe to test Mark as safe to test label Nov 14, 2025
}

var errOffline = status.Error(codes.Unavailable, "host appears to be offline; ensure machine is online and try again")
var ErrOffline = errors.New("host appears to be offline; ensure machine is online and try again")
Copy link
Member

Choose a reason for hiding this comment

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

Why remove the "unavailable" status?

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see the comment from your other PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated it to just check for ErrOffline by making ErrOffline a regular error instead of a status. I think making it status() was double wrapping it down the line because the original error was rpc error: code = Unavailable desc = requestID=99cc1420b3f4e658458dc61ec70cb033: rpc error: code = Unavailable desc = host appears to be offline; ensure machine is online and try again; context deadline exceeded; mDNS query failed to find a candidate

pasting it here so its easier for others to see^!

Copy link
Member

Choose a reason for hiding this comment

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

what does the error become with this change? you can test this by pointing goutils on app to this change and running the cli/sdk against it. I ask because I would like to keep the Unavailable code if possible, so if we lose that we should think of ways to keep it in

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm reverting this change because the new error status has the error as "unknown" vs "unavailable". So something else is re-wrapping this error status but without the "unavailable" status wanted. I think you can get the error message from the status by converting it later on anyways

Copy link
Member

Choose a reason for hiding this comment

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

if we're exporting this, we should name this var something something more specific ErrHostOffline or something like that. I think it would actually be fine to leave this as a status.Error, and I want to change to code to NotFound, since it matches better and is not duplicated elsewhere in this file https://grpc.io/docs/guides/status-codes/#the-full-list-of-status-codes. Then we can match on the status code in the rdk

@allisonschiang allisonschiang added the safe to test Mark as safe to test label Nov 14, 2025
@viambot viambot removed the safe to test Mark as safe to test label Nov 14, 2025
@cheukt cheukt added the safe to test Mark as safe to test label Nov 18, 2025
@viambot viambot removed the safe to test Mark as safe to test label Nov 18, 2025
@github-actions
Copy link

For security reasons, this PR must be labeled with safe to test in order for tests to run.

@allisonschiang allisonschiang added the safe to test Mark as safe to test label Nov 18, 2025
}

var errOffline = status.Error(codes.Unavailable, "host appears to be offline; ensure machine is online and try again")
var ErrOffline = errors.New("host appears to be offline; ensure machine is online and try again")
Copy link
Member

Choose a reason for hiding this comment

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

if we're exporting this, we should name this var something something more specific ErrHostOffline or something like that. I think it would actually be fine to leave this as a status.Error, and I want to change to code to NotFound, since it matches better and is not duplicated elsewhere in this file https://grpc.io/docs/guides/status-codes/#the-full-list-of-status-codes. Then we can match on the status code in the rdk

}

// ErrMDNSQueryFailed is returned when a mDNS query fails to find a candidate.
var ErrMDNSQuery = errors.New("mDNS query failed to find a candidate")
Copy link
Member

Choose a reason for hiding this comment

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

this is not a very descriptive name - can we name this ErrMDNSNoCandidatesFound or something in that vein?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Mark as safe to test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants