Skip to content

Guard #onWmeSelectionChanged against unsupported SDK selection types#13

Open
JS55CT wants to merge 4 commits intoWazeDev:masterfrom
JS55CT:master
Open

Guard #onWmeSelectionChanged against unsupported SDK selection types#13
JS55CT wants to merge 4 commits intoWazeDev:masterfrom
JS55CT:master

Conversation

@JS55CT
Copy link
Copy Markdown
Contributor

@JS55CT JS55CT commented Mar 26, 2026

Waze recently added Google Places as a clickable layer in WME. When a Google Place is selected, sdk.Editing.getSelection() throws WMEError: Selection contains an unexpected object type googlePlace because googlePlace is defined in ObjectType but is not in the SDK's SELECTABLE_OBJECT_TYPES list.

The wme-selection-changed event fires for all selection changes (including Google Places), but since the event payload is always undefined, there is no way to pre-screen the type before calling getSelection(). The only reliable guard is a try/catch.

SDKGoogleLinkEnhancer only operates on venue selections, so returning early on any unsupported type is the correct behavior — nothing is lost.

Before: #onWmeSelectionChanged called this.sdk.Editing.getSelection() unguarded, throwing an unhandled exception on every Google Place click.

After: The call is wrapped in try/catch; on error the handler returns silently.

JS55CT and others added 4 commits March 26, 2026 14:34
Waze recently added Google Places as a clickable layer in WME. When a Google Place is selected, sdk.Editing.getSelection() throws WMEError: Selection contains an unexpected object type googlePlace because googlePlace is defined in ObjectType but is not in the SDK's SELECTABLE_OBJECT_TYPES list.

The wme-selection-changed event fires for all selection changes (including Google Places), but since the event payload is always undefined, there is no way to pre-screen the type before calling getSelection(). The only reliable guard is a try/catch.

SDKGoogleLinkEnhancer only operates on venue selections, so returning early on any unsupported type is the correct behavior — nothing is lost.

Before: #onWmeSelectionChanged called this.sdk.Editing.getSelection() unguarded, throwing an unhandled exception on every Google Place click.

After: The call is wrapped in try/catch; on error the handler returns silently.
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.

1 participant