Return HttpInvalid error instead of FastlyStatus::Error when failed to build Uri#378
Open
arayaryoma wants to merge 1 commit intofastly:mainfrom
Open
Conversation
…o build Uri Fastly Rust SDK maps `FastlyStatus::Error` to `BackendCreationError::NameInUse`. It's a misleading behavior for developers, who will assume they register the same backend multitimes
Contributor
|
This is going in a good direction, but the name of the error itself seems incorrect: the parameter to the backend builder is not a URL, so the error cannot indicate that the user provided an 'invalid backend URL' (even though the provided value is used in constructing a URL). Should it be Edit: I realize this is internal to Viceroy, but I'd still prefer the name to be accurate for the benefit of future readers of the code. It would also be nice if we had a better |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fastly Rust SDK maps
FastlyStatus::ErrortoBackendCreationError::NameInUse.By this, when we passed invalid host name value to
fastly::Backend::builderfunc, we always receivedNameInUseerror.It's a misleading behavior for developers, who will assume they register the same backend multiple times.
In this PR, I defined a new internal Error
InvalidBackendUrland map it asFastlyStatus::HttpInvalid.It will help developers to awake they are using invalid URI to build the dynamic backend.
Example
before
after