Surface HTTP and audio system error details#134
Open
orenidan wants to merge 3 commits intodimitris-c:mainfrom
Open
Surface HTTP and audio system error details#134orenidan wants to merge 3 commits intodimitris-c:mainfrom
orenidan wants to merge 3 commits intodimitris-c:mainfrom
Conversation
243b5d4 to
ab0300e
Compare
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.
Summary
NetworkError.serverErrorto carryHTTPResponseDetailsinstead of only a status codeNetworkErrorvalues throughAudioPlayerinstead of flattening them into generic failuresWhy
Today the library collapses several useful failure modes into generic errors before they reach consumers.
For HTTP failures,
RemoteAudioSourcesees the fullHTTPURLResponse, but only surfaces a bareserverErrorvalue. That loses context that is often required to debug real-world stream failures, such as:That loss of detail makes it hard for apps using the library to distinguish cases like:
403This came up in practice while debugging a station that:
403There is a similar issue on the playback side: typed
NetworkErrorvalues were being wrapped again as generic.failure(error)values before reaching consumers. This PR keeps those typed errors intact so the additional diagnostics are not lost on the way out.For audio system failures, the library already had typed cases such as
engineFailureandplayerNotFound, but those cases did not always preserve any underlying error details. This PR keeps domain/code information where available so consumers can see more than a generic failure string.Scope
This PR is focused on diagnostics and error surfacing. It does not change the library's existing HTTP failure classification behavior; it preserves more context for failures the library already treats as errors.
Testing
swift test --filter NetworkErrorTests