File tree Expand file tree Collapse file tree 10 files changed +30
-23
lines changed Expand file tree Collapse file tree 10 files changed +30
-23
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ export default function Error({
1212} ) {
1313 useEffect ( ( ) => {
1414 // Log the error to an error reporting service
15- console . error ( error ) ;
15+ console . log ( error ) ;
1616 } , [ error ] ) ;
1717
1818 return (
1919 < div className = "flex h-[calc(100vh-160px)] w-full flex-col items-center justify-center gap-y-4" >
20- < h2 className = " text-5xl font-bold text-destructive" >
20+ < h2 className = "text-5xl font-bold text-destructive" >
2121 Oops, Something Went Wrong!
2222 </ h2 >
2323 < Button onClick = { ( ) => reset ( ) } > Try Again</ Button >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414import { Button } from "~/components/ui/button" ;
1515import { Card , CardDescription , CardTitle } from "~/components/ui/card" ;
1616import { toast } from "~/hooks/use-toast" ;
17+ import { isRedirectError } from "~/lib/utils" ;
1718import { deleteProjectById } from "../action" ;
1819
1920export default function DeleteCard ( { id } : { id : string } ) {
@@ -27,12 +28,14 @@ export default function DeleteCard({ id }: { id: string }) {
2728 } ) ;
2829 } )
2930 . catch ( ( error ) => {
30- console . error ( error ) ;
31- toast ( {
32- title : "Error deleting project." ,
33- description : "Please try again." ,
34- variant : "destructive" ,
35- } ) ;
31+ console . log ( error ) ;
32+ if ( ! isRedirectError ( error ) ) {
33+ toast ( {
34+ title : "Error deleting project." ,
35+ description : "Please try again." ,
36+ variant : "destructive" ,
37+ } ) ;
38+ }
3639 } )
3740 ) ;
3841 } ;
Original file line number Diff line number Diff line change @@ -18,12 +18,6 @@ import { toast } from "~/hooks/use-toast";
1818import { updateProjectById } from "../action" ;
1919import { projectSchema , type ProjectFormValues } from "../create-project-modal" ;
2020
21- // const projectEditSchema = projectSchema.extend({
22- // id: z.string().readonly(),
23- // });
24-
25- // type ProjectEditValues = z.infer<typeof projectEditSchema>;
26-
2721export default function EditableDetails ( {
2822 initialValues,
2923} : {
@@ -42,7 +36,7 @@ export default function EditableDetails({
4236 } ) ;
4337 form . reset ( ) ;
4438 } catch ( error ) {
45- console . error ( error ) ;
39+ console . log ( error ) ;
4640 toast ( {
4741 title : "Error creating project." ,
4842 description : "Please try again." ,
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ export default function CreateProjectModal() {
5858 form . reset ( ) ;
5959 setIsOpen ( false ) ;
6060 } catch ( error ) {
61- console . error ( { error } ) ;
61+ console . log ( error ) ;
6262 if ( error instanceof FreePlanLimitError ) {
6363 return toast ( {
6464 title : "Free plan limit reached. Please upgrade your plan." ,
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export async function removeUserOldImageFromCDN(
2626 await utapi . deleteFiles ( currentImageFileKey as string ) ;
2727 }
2828 } catch ( e ) {
29- console . error ( e ) ;
29+ console . log ( e ) ;
3030 const newImageFileKey = getImageKeyFromUrl ( newImageUrl ) ;
3131 await utapi . deleteFiles ( newImageFileKey as string ) ;
3232 }
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ export default function Error({
1212} ) {
1313 useEffect ( ( ) => {
1414 // Log the error to an error reporting service
15- console . error ( error ) ;
15+ console . log ( error ) ;
1616 } , [ error ] ) ;
1717
1818 return (
1919 < div className = "flex h-full w-full flex-col items-center justify-center gap-y-4" >
20- < h2 className = " text-4xl font-bold text-destructive" >
20+ < h2 className = "text-4xl font-bold text-destructive" >
2121 Something Went Wrong!
2222 </ h2 >
2323 < Button onClick = { ( ) => reset ( ) } > Try Again</ Button >
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export default function SettingsForm({ currentUser }: { currentUser: User }) {
8585 try {
8686 await removeNewImageFromCDN ( getValues ( ) . picture ) ;
8787 } catch ( error ) {
88- console . error ( error ) ;
88+ console . log ( error ) ;
8989 }
9090 }
9191 reset ( ) ;
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ export default function GlobalError({
1212} ) {
1313 useEffect ( ( ) => {
1414 // Log the error to an error reporting service
15- console . error ( error ) ;
15+ console . log ( error ) ;
1616 } , [ error ] ) ;
1717
1818 return (
1919 < div className = "flex h-[calc(100vh-160px)] w-full flex-col items-center justify-center gap-y-4" >
20- < h2 className = " text-5xl font-bold text-destructive" >
20+ < h2 className = "text-5xl font-bold text-destructive" >
2121 Oops, Something Went Wrong!
2222 </ h2 >
2323 < Button onClick = { ( ) => reset ( ) } > Try Again</ Button >
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export default function ImageUploadModal({
4747 }
4848 } ,
4949 onUploadError : ( e ) => {
50- console . error ( e ) ;
50+ console . log ( e ) ;
5151 toast ( {
5252 title : "Error occurred while uploading!" ,
5353 variant : "destructive" ,
Original file line number Diff line number Diff line change @@ -53,3 +53,13 @@ export class FreePlanLimitError extends Error {
5353 super ( message ) ;
5454 }
5555}
56+
57+ export function isRedirectError ( error : unknown ) : boolean {
58+ return (
59+ error !== null &&
60+ typeof error === "object" &&
61+ "digest" in error &&
62+ typeof error . digest === "string" &&
63+ error . digest . includes ( "NEXT_REDIRECT" )
64+ ) ;
65+ }
You can’t perform that action at this time.
0 commit comments