Repository navigation
feat: log warning for Gen 1-only operations - #2290
Merged
Merged
Conversation
veronika-alraheem
marked this pull request as draft
November 19, 2026 14:26
veronika-alraheem
force-pushed
the
1318-gen1-warnings
branch
from
November 19, 2026 19:37
372fdde to
d5a2b8e
Compare
veronika-alraheem
marked this pull request as ready for review
November 19, 2026 19:40
veronika-alraheem
force-pushed
the
1318-gen1-warnings
branch
from
November 25, 2026 11:23
8cb5488 to
d621024
Compare
ricellis
reviewed
Nov 26, 2026
ricellis
left a comment
Member
There was a problem hiding this comment.
Looks good, one thing and some nits
| logger.warn(message); | ||
| if (isGen1ErrorEnabled()) { | ||
| const err = new UnsupportedOperationError(message); | ||
| err.code = 'ERR_UNSUPPORTED_OPERATION'; |
Member
There was a problem hiding this comment.
For our other validation rules based we used ERR_INVALID_ARG_VALUE that is a Node.js error code that happened to be correct for what we were checking, an invalid arg value.
For this new validation there doesn't appear to be a native code that would work, so I'm a little concerned about using a made up code that looks like a Node.js one (not least because they might use it later for something slightly different). We should probably just use our own code e.g.
Suggested change
| err.code = 'ERR_UNSUPPORTED_OPERATION'; | |
| err.code = 'CLOUDANT_SDK_UNSUPPORTED_OPERATION'; |
| it(`Throws for ${operationId} when errors are enabled`, async () => { | ||
| process.env[gen1ErrorsVar] = 'true'; | ||
| await assert.rejects(service.createRequest(params(operationId)), { | ||
| code: 'ERR_UNSUPPORTED_OPERATION', |
| process.env[gen1ErrorsVar] = 'TRUE'; | ||
| await assert.rejects( | ||
| service.createRequest(params('getCorsInformation')), | ||
| { code: 'ERR_UNSUPPORTED_OPERATION' } |
veronika-alraheem
force-pushed
the
1318-gen1-warnings
branch
from
November 26, 2026 14:58
d621024 to
c221186
Compare
ricellis
approved these changes
Nov 26, 2026
veronika-alraheem
force-pushed
the
1318-gen1-warnings
branch
from
November 26, 2026 16:38
c221186 to
ec99198
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.
PR summary
Emit a log warning for operations only available for Gen 1.
Fixes i1318
PR Checklist
Please make sure that your PR fulfills the following requirements:
Angular Commit Message Guidelines.
PR Type
What is the current behavior?
Calls to Gen 1-only operations execute without any user-facing warning that they are unavailable for Gen 2.
What is the new behavior?
CloudantBaseService.createRequestchecks the request URL against^/_api/v2(/|$). On a match it logs:Does this PR introduce a breaking change?
Other information