Skip to content

fixes error handling to match specification #727

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

Merged
merged 1 commit into from
Dec 7, 2019

Conversation

OlegDokuka
Copy link
Member

This PR extends the current implementation of error handling to match what is defined in the spec and let the user use a range of user allowed error codes using CastomRSocketException class
Signed-off-by: Oleh Dokuka [email protected]

@OlegDokuka OlegDokuka force-pushed the bugfix/extended-error-handling branch from 8f5f49b to e11f307 Compare December 7, 2019 12:11
@OlegDokuka OlegDokuka force-pushed the bugfix/extended-error-handling branch from e11f307 to 0322be9 Compare December 7, 2019 12:41
@OlegDokuka
Copy link
Member Author

@gregwhitaker ☝️

@OlegDokuka OlegDokuka merged commit 9bc8032 into develop Dec 7, 2019
@OlegDokuka OlegDokuka deleted the bugfix/extended-error-handling branch December 7, 2019 16:16
Copy link
Member

@yschimke yschimke left a comment

Choose a reason for hiding this comment

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

“|| errorCode <= MAX_USER_ALLOWED_ERROR_CODE) {“
This appears broken due to overflow

Copy link
Member

@yschimke yschimke left a comment

Choose a reason for hiding this comment

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

if (errorCode > ErrorType.MAX_USER_ALLOWED_ERROR_CODE
+        && errorCode < ErrorType.MIN_USER_ALLOWED_ERROR_CODE)

Looks iffy. Should we perform these checks in unsigned longs?

return new InvalidException(message);
default:
if (errorCode >= MIN_USER_ALLOWED_ERROR_CODE
|| errorCode <= MAX_USER_ALLOWED_ERROR_CODE) {
Copy link
Member

Choose a reason for hiding this comment

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

On re-reading on a computer (not Github iOS tesatflight app :), this seems good.

          if (errorCode >= 769
              || errorCode <= -2) {

Comment on lines +20 to +21
if (errorCode > ErrorType.MAX_USER_ALLOWED_ERROR_CODE
&& errorCode < ErrorType.MIN_USER_ALLOWED_ERROR_CODE) {
Copy link
Member

Choose a reason for hiding this comment

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

Looks legit, sorry.

    if (errorCode > -2
        && errorCode < 769) {

Copy link
Member

@yschimke yschimke left a comment

Choose a reason for hiding this comment

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

LGTM

@OlegDokuka
Copy link
Member Author

So, yeah, to clarify, since error API expect int and return int, we cannot use long for that purpose, that is why had to deal with such unobvious comparison

OlegDokuka added a commit that referenced this pull request Mar 2, 2020
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.

3 participants