Skip to content

fix : added error handling and input guard to trackActivity utility - #9

Open
tmdeveloper007 wants to merge 1 commit into
syedahmedkhaderi:mainfrom
tmdeveloper007:activity-error-handling
Open

fix : added error handling and input guard to trackActivity utility#9
tmdeveloper007 wants to merge 1 commit into
syedahmedkhaderi:mainfrom
tmdeveloper007:activity-error-handling

Conversation

@tmdeveloper007

Copy link
Copy Markdown

Summary of What Has Been Done:
Added try-catch error handling around the Supabase select and insert calls in trackActivity. Errors from either operation are now logged to console.error for observability. Added an input guard to skip processing if userId is missing or not a string.

Changes Made:

  • lib/activity.js: Wrapped select and insert calls in try-catch, added early return for invalid userId, logs errors with a [trackActivity] prefix.

Impact it Made:

  • Errors from Supabase operations are now visible in server logs instead of being silently swallowed
  • Prevents unexpected behavior when userId is undefined or non-string
  • Verified with ESLint: no new errors introduced

Note: Please assign this PR to the tmdeveloper007 account.

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