fix(backend): use relationshipType in groupDeleteRelation error message (#16780)#16781
Open
YAMRAJ13y wants to merge 1 commit into
Open
fix(backend): use relationshipType in groupDeleteRelation error message (#16780)#16781YAMRAJ13y wants to merge 1 commit into
YAMRAJ13y wants to merge 1 commit into
Conversation
…ge (OpenCTI-Platform#16780) groupDeleteRelation referenced the local 'input' variable in the validation error message before it is declared (it is a const declared ~10 lines later), so a non-internal relationshipType produced a ReferenceError (temporal dead zone) instead of the intended FunctionalError. Use the relationshipType parameter directly in the message. Closes OpenCTI-Platform#16780
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.
Proposed changes
groupDeleteRelationinsrc/domain/group.jsreferenced the localinputvariable in its validation error message beforeinputis declared (it is aconstdeclared ~10 lines further down). Accessing it there hits the temporal dead zone, so calling the function with a non-internalrelationshipTypethrowsReferenceError: Cannot access 'input' before initializationinstead of the intendedFunctionalErrorwith a clear message.The fix uses the
relationshipTypeparameter (already in scope) directly in the message — a one-line change.Related issues
Closes #16780
How to test
Call
groupDeleteRelationwith a non-internal relationship type; it now returns the intended validation error (Only ... can be deleted through this method, got <type>.) instead of aReferenceError.