Skip to content

Replace NetworkError::Internal with structured enum variants for calls with literal strings#36599

Merged
TimvdLippe merged 10 commits intoservo:mainfrom
uthmaniv:network-error-variants
Jan 2, 2026
Merged

Replace NetworkError::Internal with structured enum variants for calls with literal strings#36599
TimvdLippe merged 10 commits intoservo:mainfrom
uthmaniv:network-error-variants

Conversation

@uthmaniv
Copy link
Copy Markdown
Member

@uthmaniv uthmaniv commented Apr 18, 2025

Replace NetworkError::Internal with structured enum variants

  • Adds UnsupportedScheme,CorsViolation,ConnectionFailure,Timeout,RedirectError,InvalidMethod,ResourceError,SecurityBlock,MixedContent,CacheError,InvalidPort, LocalDirectoryError, variants in NetworkError enum.
  • Refactored the usage of NetworkError::Internal(String) to use the appropriate new variant

Testing: Changes does not require test.
Fixes: #36434

Copy link
Copy Markdown
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

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

Good start!

@uthmaniv uthmaniv force-pushed the network-error-variants branch from 7993620 to c7d205d Compare April 22, 2025 15:05
@Barry-dE
Copy link
Copy Markdown
Contributor

Barry-dE commented Apr 23, 2025

@uthmaniv The PR isn't getting linked to the issue. I think removing "part of" before the issue number fixes this.

@uthmaniv uthmaniv force-pushed the network-error-variants branch from fac0d52 to 1b396e5 Compare April 24, 2025 00:01
@uthmaniv uthmaniv requested a review from gterzian as a code owner April 24, 2025 00:01
@uthmaniv uthmaniv force-pushed the network-error-variants branch 2 times, most recently from 9f4fec8 to be1c845 Compare April 24, 2025 13:51
Copy link
Copy Markdown
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

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

This is close! Just a couple more requests for clarity in the new errors.

@uthmaniv uthmaniv force-pushed the network-error-variants branch from 0abd71e to be1c845 Compare April 27, 2025 18:08
Copy link
Copy Markdown
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

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

Let's make sure we use the new variant!

@uthmaniv uthmaniv force-pushed the network-error-variants branch from bd2c6f1 to d64aa28 Compare May 23, 2025 22:34
@servo-wpt-sync
Copy link
Copy Markdown
Collaborator

🛠 These changes could not be applied onto the latest upstream WPT. Servo's copy of the Web Platform Tests may be out of sync.

@TimvdLippe
Copy link
Copy Markdown
Contributor

@uthmaniv apologies for the delay in following up on this PR. Are you still interested in contributing it? If not, we can also resolve the merge conflicts and get it done. Thanks for helping Servo!

@uthmaniv
Copy link
Copy Markdown
Member Author

@uthmaniv apologies for the delay in following up on this PR. Are you still interested in contributing it? If not, we can also resolve the merge conflicts and get it done. Thanks for helping Servo!

Yes I am still interested in contributing to the servo project, I will look into the PR ,update it and resolve the conflicts . Thanks

uthmaniv and others added 8 commits January 1, 2026 11:28
…ith granular enum variants

Signed-off-by: Uthman Yahaya Baba <[email protected]>
…with granular enum variants

Signed-off-by: Uthman Yahaya Baba <[email protected]>
Signed-off-by: Uthman Yahaya Baba <[email protected]>
Signed-off-by: Uthman Yahaya Baba <[email protected]>
…with granular enum variants

Signed-off-by: Uthman Yahaya Baba <[email protected]>
Signed-off-by: Uthman Yahaya Baba <[email protected]>
Signed-off-by: Usman Yahaya Baba <[email protected]>
@uthmaniv uthmaniv force-pushed the network-error-variants branch from f0eec0a to a06d848 Compare January 1, 2026 14:10
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 1, 2026
Signed-off-by: Tim van der Lippe <[email protected]>
Copy link
Copy Markdown
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

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

I have addressed the two remaining comments from Josh in a commit and pushed that it to this PR. Thanks for contributing!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jan 1, 2026
@TimvdLippe TimvdLippe enabled auto-merge January 1, 2026 14:56
@uthmaniv
Copy link
Copy Markdown
Member Author

uthmaniv commented Jan 1, 2026

I have addressed the two remaining comments from Josh in a commit and pushed that it to this PR. Thanks for contributing!

It's a pleasure. Thank you

@TimvdLippe TimvdLippe added this pull request to the merge queue Jan 1, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 1, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 1, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jan 1, 2026
@TimvdLippe TimvdLippe added this pull request to the merge queue Jan 1, 2026
@servo-highfive servo-highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Jan 1, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 1, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jan 1, 2026
@Loirooriol
Copy link
Copy Markdown
Contributor

Rather than listening all individual errors, the only case
where we shouldn't do anything is `LoadCancelled`. In fact,
we should return early here, since otherwise we go through
the full script_thread to eventually return anyways on
line 1262 since there are no page headers available.

Signed-off-by: Tim van der Lippe <[email protected]>
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Jan 2, 2026
@TimvdLippe TimvdLippe enabled auto-merge January 2, 2026 10:21
@TimvdLippe TimvdLippe added this pull request to the merge queue Jan 2, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 2, 2026
Merged via the queue into servo:main with commit 6decaae Jan 2, 2026
32 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NetworkError::Internal should use an enum instead of a string

7 participants