Skip to content

Conversation

rutvik24
Copy link
Contributor

No description provided.

rutvik and others added 2 commits June 26, 2025 20:39
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a unified try/catch wrapper and refactors storage and helper functions to use it for consistent error handling.

  • Introduces wrapAsync and wrapSync utilities in TryCatchWrapper.ts
  • Refactors storage helpers to use wrapSync
  • Wraps async helper methods (openLink, login handlers, version checks) with wrapAsync

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
App/Utils/index.ts Exports new TryCatchWrapper
App/Utils/TryCatchWrapper.ts New error‐handling wrappers (wrapAsync, wrapSync)
App/Utils/Storage.ts Refactored storage methods to use wrapSync
App/Utils/Helper.ts Wrapped openLink with wrapAsync and updated imports
App/Screens/Components/Login/Login.tsx Wrapped onLogin handler with wrapAsync
App/Screens/Components/Home/Home.tsx Wrapped version checks and updateApp with wrapAsync
Comments suppressed due to low confidence (7)

App/Utils/Storage.ts:60

  • [nitpick] Method names mix 'Storage' (e.g., setItemInStorage) with 'Store' (removeStoreItem, setObjectInStore). Consider unifying to 'Storage' for consistency.
export const removeStoreItem = wrapSync(

App/Utils/TryCatchWrapper.ts:41

  • [nitpick] Consider adding unit tests for wrapAsync and wrapSync to verify error handling, default logging, and onFinally behavior across edge cases.
interface TryCatchOptions {

App/Utils/index.ts:1

  • Storage utilities (e.g., setItemInStorage) live in Storage.ts but are not re-exported here, so importing from '@utils' will fail. Add export * from '@Utils/Storage';.
export * from '@Utils/TryCatchWrapper';

App/Utils/Storage.ts:24

  • Empty strings are falsy, so this will return null for valid empty values. Use value !== undefined to distinguish empty strings from missing keys.
    if (value) {

App/Utils/Storage.ts:37

  • Zero (0) is falsy, so a stored 0 will return null. Change the check to value !== undefined to correctly return zero values.
    if (value) {

App/Utils/Storage.ts:50

  • Boolean false is falsy, causing valid false values to be dropped. Use explicit value !== undefined to return actual false values.
    if (value) {

App/Utils/Storage.ts:10

  • [nitpick] wrapSync returns undefined on errors, but your custom handlers return null, leading to inconsistent return values. Standardize on one (null or undefined).
const onError = () => null;

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