-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into domain-wide-delegatio…
…n-google-calendar
- Loading branch information
Showing
163 changed files
with
1,912 additions
and
1,680 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
undecided: | ||
- "@calcom/app-store-cli" | ||
- "@calcom/platform-constants" | ||
- "@calcom/platform-enums" | ||
- "@calcom/platform-types" | ||
- "@calcom/platform-utils" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
undecided: | ||
- calcom-monorepo | ||
- "@calcom/prisma" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,64 @@ | ||
"use client"; | ||
|
||
import { captureException } from "@sentry/nextjs"; | ||
/** | ||
* Typescript class based component for custom-error | ||
* @link https://nextjs.org/docs/advanced-features/custom-error-page | ||
*/ | ||
import type { NextPage } from "next"; | ||
import type { ErrorProps } from "next/error"; | ||
import React from "react"; | ||
|
||
import { getErrorFromUnknown } from "@calcom/lib/errors"; | ||
import { HttpError } from "@calcom/lib/http-error"; | ||
import logger from "@calcom/lib/logger"; | ||
import { redactError } from "@calcom/lib/redactError"; | ||
|
||
import { ErrorPage } from "@components/error/error-page"; | ||
|
||
const log = logger.getSubLogger({ prefix: ["[error]"] }); | ||
type NextError = Error & { digest?: string }; | ||
|
||
type ErrorProps = { | ||
error: Error; | ||
reset: () => void; | ||
// Ref: https://nextjs.org/docs/app/api-reference/file-conventions/error#props | ||
export type DefaultErrorProps = { | ||
error: NextError; | ||
reset: () => void; // A function to reset the error boundary | ||
}; | ||
|
||
export default function Error({ error, reset }: ErrorProps) { | ||
React.useEffect(() => { | ||
log.error(error); | ||
|
||
// Log the error to Sentry | ||
captureException(error); | ||
}, [error]); | ||
|
||
const processedError = React.useMemo(() => { | ||
const err = getErrorFromUnknown(error); | ||
|
||
if (err instanceof HttpError) { | ||
const redactedError = redactError(err); | ||
return { | ||
statusCode: err.statusCode, | ||
title: redactedError.name, | ||
name: redactedError.name, | ||
message: redactedError.message, | ||
url: err.url, | ||
method: err.method, | ||
cause: err.cause, | ||
}; | ||
} | ||
|
||
return { | ||
statusCode: 500, | ||
title: "Internal Server Error", | ||
name: "Internal Server Error", | ||
message: "An unexpected error occurred.", | ||
type AugmentedError = NextError | HttpError | null; | ||
|
||
type CustomErrorProps = { | ||
err?: AugmentedError; | ||
statusCode?: number; | ||
message?: string; | ||
} & Omit<ErrorProps, "err" | "statusCode">; | ||
|
||
const log = logger.getSubLogger({ prefix: ["[error]"] }); | ||
|
||
const CustomError: NextPage<DefaultErrorProps> = (props) => { | ||
const { error } = props; | ||
let errorObject: CustomErrorProps = { | ||
message: error.message, | ||
err: error, | ||
}; | ||
|
||
if (error instanceof HttpError) { | ||
const redactedError = redactError(error); | ||
errorObject = { | ||
statusCode: error.statusCode, | ||
title: redactedError.name, | ||
message: redactedError.message, | ||
err: { | ||
...redactedError, | ||
...error, | ||
}, | ||
}; | ||
}, [error]); | ||
} | ||
|
||
// `error.digest` property contains an automatically generated hash of the error that can be used to match the corresponding error in server-side logs | ||
log.debug(`${error?.toString() ?? JSON.stringify(error)}`); | ||
log.info("errorObject: ", errorObject); | ||
|
||
return ( | ||
<ErrorPage | ||
statusCode={processedError.statusCode} | ||
error={processedError} | ||
message={processedError.message} | ||
/> | ||
<ErrorPage statusCode={errorObject.statusCode} error={errorObject.err} message={errorObject.message} /> | ||
); | ||
} | ||
}; | ||
|
||
export default CustomError; |
File renamed without changes.
Oops, something went wrong.