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

Deprecate SRStatusNoStatusReceived and update naming for consistency #695

Closed

Conversation

nnabeyang
Copy link
Contributor

This PR introduces a renaming of SRStatusNoStatusReceived to SRStatusCodeNoStatusReceived for better consistency with the existing naming conventions. The old constant is now marked as deprecated with a message guiding developers to use the new SRStatusCodeNoStatusReceived instead.

Additionally, the updated naming makes it easier to write clean and understandable code in Swift, as shown in this example:

func testSRStatusCode() throws {
    XCTAssertEqual(SRStatusCode.normal.rawValue, 1000)
    XCTAssertEqual(SRStatusCode.goingAway.rawValue, 1001)
    XCTAssertEqual(SRStatusCode.protocolError.rawValue, 1002)
    XCTAssertEqual(SRStatusCode.unhandledType.rawValue, 1003)
    XCTAssertEqual(SRStatusCode.noStatusReceived.rawValue, 1005)
    XCTAssertEqual(SRStatusCode.abnormal.rawValue, 1006)
    XCTAssertEqual(SRStatusCode.invalidUTF8.rawValue, 1007)
    XCTAssertEqual(SRStatusCode.policyViolated.rawValue, 1008)
    XCTAssertEqual(SRStatusCode.messageTooBig.rawValue, 1009)
    XCTAssertEqual(SRStatusCode.missingExtension.rawValue, 1010)
    XCTAssertEqual(SRStatusCode.internalError.rawValue, 1011)
    XCTAssertEqual(SRStatusCode.serviceRestart.rawValue, 1012)
    XCTAssertEqual(SRStatusCode.tryAgainLater.rawValue, 1013)
    XCTAssertEqual(SRStatusCode.tlsHandshake.rawValue, 1015)
}

Copy link

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

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

Thanks for this fix!

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@cipolleschi merged this pull request in a9872b7.

@nnabeyang nnabeyang deleted the fix-sr_status_code branch November 15, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants