Skip to content

Conversation

@joeauyeung
Copy link
Contributor

What does this PR do?

  • Returns the error message from a calendar if calling getConnectedCalendar

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

@graphite-app graphite-app bot requested a review from a team November 21, 2025 21:09
@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Nov 21, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2025

E2E results are ready!

};
} catch (error) {
let errorMessage = "Could not get connected calendars";
let errorMessage = error;
Copy link
Contributor

@Udit-takkar Udit-takkar Nov 21, 2025

Choose a reason for hiding this comment

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

are we okay exposing this to the end user?

@vercel
Copy link

vercel bot commented Nov 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Nov 24, 2025 7:17pm
cal-eu Ignored Ignored Nov 24, 2025 7:17pm

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/features/calendars/lib/CalendarManager.ts">

<violation number="1" location="packages/features/calendars/lib/CalendarManager.ts:124">
`errorMessage` is now initialized with the raw `error` object, but it is only converted to a string inside the `invalid_grant` and `CalendarAppDelegationCredentialError` branches. For every other error, `errorMessage` remains an `Error` instance, so the returned `{ error: { message: errorMessage } }` serializes to `{}` because `Error` properties are non-enumerable. Clients therefore lose the actual failure reason, which is the opposite of the PR goal of returning the calendar error message.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

};
} catch (error) {
let errorMessage = "Could not get connected calendars";
let errorMessage = error;
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 24, 2025

Choose a reason for hiding this comment

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

errorMessage is now initialized with the raw error object, but it is only converted to a string inside the invalid_grant and CalendarAppDelegationCredentialError branches. For every other error, errorMessage remains an Error instance, so the returned { error: { message: errorMessage } } serializes to {} because Error properties are non-enumerable. Clients therefore lose the actual failure reason, which is the opposite of the PR goal of returning the calendar error message.

Prompt for AI agents
Address the following comment on packages/features/calendars/lib/CalendarManager.ts at line 124:

<comment>`errorMessage` is now initialized with the raw `error` object, but it is only converted to a string inside the `invalid_grant` and `CalendarAppDelegationCredentialError` branches. For every other error, `errorMessage` remains an `Error` instance, so the returned `{ error: { message: errorMessage } }` serializes to `{}` because `Error` properties are non-enumerable. Clients therefore lose the actual failure reason, which is the opposite of the PR goal of returning the calendar error message.</comment>

<file context>
@@ -122,7 +121,7 @@ export const getConnectedCalendars = async (
         };
       } catch (error) {
-        let errorMessage = &quot;Could not get connected calendars&quot;;
+        let errorMessage = error;
 
         // Here you can expect for specific errors
</file context>
Suggested change
let errorMessage = error;
let errorMessage = error instanceof Error ? error.message : typeof error === "string" ? error : "Could not get connected calendars";
Fix with Cubic

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

Labels

core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants