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

Error::UnsupportedKeyType holds a String #161

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

rukai
Copy link
Contributor

@rukai rukai commented Jun 19, 2023

Previously errors looked like: UnsupportedKeyType([114, 115, 97])
But with this PR they now look like: UnsupportedKeyType("rsa")

@Eugeny
Copy link
Owner

Eugeny commented Jun 20, 2023

Thank you for your contribution @rukai , however russh aims to provide an unambiguous interface to the SSH protocol. Conditionally stringifying key_type here creates a situation where it's unclear whether a string was sent as-is or is a result of format!()

@Eugeny Eugeny closed this Jun 20, 2023
@rukai
Copy link
Contributor Author

rukai commented Jun 20, 2023

Some alternatives:

Would one of these work?
I'm sure we can find a solution where the error is both readable and unambiguous.

@Eugeny
Copy link
Owner

Eugeny commented Jun 20, 2023

Making UnsupportedKeyType a struct variant would be fine by me :)

@Eugeny Eugeny reopened this Jun 20, 2023
@rukai rukai force-pushed the improve_unsupported_key_type_errors branch 2 times, most recently from 0cef5fa to 355c1ae Compare June 20, 2023 23:22
@rukai
Copy link
Contributor Author

rukai commented Jun 20, 2023

Alright, I rewrote the PR to have both a raw and string field in a struct variant.

@rukai rukai force-pushed the improve_unsupported_key_type_errors branch from 355c1ae to b2a4f77 Compare August 2, 2023 06:04
@Eugeny Eugeny merged commit 531fe30 into Eugeny:master Aug 2, 2023
3 checks passed
@Eugeny
Copy link
Owner

Eugeny commented Aug 2, 2023

LGTM! @all-contributors please add @rukai for code

@allcontributors
Copy link
Contributor

@Eugeny

I've put up a pull request to add @rukai! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants