Skip to content

bind the unused error binding in 5 swallow-only catch blocks#48786

Open
HrachShah wants to merge 1 commit into
mui:masterfrom
HrachShah:fix/annotate-catch-bindings-in-cssVars-and-slider
Open

bind the unused error binding in 5 swallow-only catch blocks#48786
HrachShah wants to merge 1 commit into
mui:masterfrom
HrachShah:fix/annotate-catch-bindings-in-cssVars-and-slider

Conversation

@HrachShah

Copy link
Copy Markdown

...

…torageManager.ts (localStorage.getItem / setItem: Safari private mode, iframe with cookies blocked, QuotaExceededError on a full storage area), useLocalStorageState.ts (getSnapshot / setValue: feature-detection for localStorage availability per the MDN docs), buildFormatNumber.ts (Intl.NumberFormat: RangeError on an invalid BCP 47 locale tag, TypeError if the runtime is missing ICU data), and useSlider.ts (setPointerCapture: invalid pointerId in synthetic events or already-released pointer). All five swallow the error and the bare 'catch' form meant the error object was not even bound. Binding to a leading-underscore identifier makes the deliberate-swallowing intent explicit in the syntax, leaves a hook for future telemetry that wants to log the swallowed error without changing the call site, and matches the style already used in adjacent code where the error is bound (useSlider, isFocusVisible, useIsFocusVisible all use 'catch (error) { ... }')
@zannager zannager added the scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI label Jul 7, 2026
@zannager zannager requested a review from siriwatknp July 7, 2026 14:22

@ZeeshanTamboli ZeeshanTamboli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's the benefit of this? What does it improve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants