Skip to content

Conversation

Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Nov 23, 2022

Checklist

@Uzlopak Uzlopak requested a review from mcollina November 23, 2022 15:16
return 1011
} else if (code === 1004 || code === 1005 || code === 1006) {
// ws module forbid those error codes usage, lift to "application level" (4xxx)
return 4000 + (code % 1000)
Copy link
Member

Choose a reason for hiding this comment

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

why was the % 1000) part unnecessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The if clause already narrows the values down to the numbers 1004, 1005 and 1006.
So the % 1000 would just return the numbers 4, 5 and 6.

So we can save us the modulo and directly add 3000 instead of 4000.

Copy link
Member

Choose a reason for hiding this comment

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

smart!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thx

@Uzlopak Uzlopak merged commit c68564f into master Nov 23, 2022
@Uzlopak Uzlopak deleted the quickmath branch November 23, 2022 15:28
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.

2 participants