Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: `errorhanlder` typo to `errorhandler`

Aashish-Upadhyay-1011899f176557a
diff --git a/lib/errorHandler.ts b/lib/errorHandler.ts
index 7f35311b..443f8993 100644
--- a/lib/errorHandler.ts
+++ b/lib/errorHandler.ts
@@ -1,6 +1,6 @@
import { NextApiResponse } from "next";
-export function errorHanlder(err: unknown, res: NextApiResponse) {
+export function errorhandler(err: unknown, res: NextApiResponse) {
if (err instanceof TeamError || err instanceof DocumentError) {
return res.status(err.statusCode).end(err.message);
} else {
diff --git a/pages/api/links/[id]/archive.ts b/pages/api/links/[id]/archive.ts
index 398e87ff..e2e2e835 100644
--- a/pages/api/links/[id]/archive.ts
+++ b/pages/api/links/[id]/archive.ts
@@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from "next";
import prisma from "@/lib/prisma";
import { getServerSession } from "next-auth/next";
import { authOptions } from "../../auth/[...nextauth]";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -44,7 +44,7 @@ export default async function handle(
return res.status(200).json(updatedLink);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
}
diff --git a/pages/api/links/[id]/visits.ts b/pages/api/links/[id]/visits.ts
index 09cdf8e1..5e98d991 100644
--- a/pages/api/links/[id]/visits.ts
+++ b/pages/api/links/[id]/visits.ts
@@ -6,7 +6,7 @@ import { log } from "@/lib/utils";
import { getViewPageDuration } from "@/lib/tinybird";
import { getDocumentWithTeamAndUser } from "@/lib/team/helper";
import { CustomUser } from "@/lib/types";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -117,7 +117,7 @@ export default async function handle(
return res.status(200).json(viewsWithDuration);
} catch (error) {
log(`Failed to get views for link ${id}. Error: \n\n ${error}`);
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow GET requests
diff --git a/pages/api/links/index.ts b/pages/api/links/index.ts
index f559f624..a9ff3dc3 100644
--- a/pages/api/links/index.ts
+++ b/pages/api/links/index.ts
@@ -5,7 +5,7 @@ import { authOptions } from "../auth/[...nextauth]";
import { hashPassword } from "@/lib/utils";
import { identifyUser, trackAnalytics } from "@/lib/analytics";
import { CustomUser } from "@/lib/types";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
import {
getDocumentWithTeamAndUser,
getTeamWithUsersAndDocument,
@@ -121,7 +121,7 @@ export default async function handler(
return res.status(200).json(linkWithView);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
}
diff --git a/pages/api/teams/[teamId]/billing/index.ts b/pages/api/teams/[teamId]/billing/index.ts
index 988d6475..5bdcd3cd 100644
--- a/pages/api/teams/[teamId]/billing/index.ts
+++ b/pages/api/teams/[teamId]/billing/index.ts
@@ -3,7 +3,7 @@ import { getServerSession } from "next-auth/next";
import { authOptions } from "../../../auth/[...nextauth]";
import { CustomUser } from "@/lib/types";
import prisma from "@/lib/prisma";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -42,7 +42,7 @@ export default async function handle(
}
return res.status(200).json(team);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
// console.log("user", user);
diff --git a/pages/api/teams/[teamId]/billing/manage.ts b/pages/api/teams/[teamId]/billing/manage.ts
index 5b870caf..b1c66854 100644
--- a/pages/api/teams/[teamId]/billing/manage.ts
+++ b/pages/api/teams/[teamId]/billing/manage.ts
@@ -4,7 +4,7 @@ import { authOptions } from "../../../auth/[...nextauth]";
import { CustomUser } from "@/lib/types";
import { stripe } from "@/lib/stripe";
import prisma from "@/lib/prisma";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -42,7 +42,7 @@ export default async function handle(
});
return res.status(200).json(url);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
res.setHeader("Allow", ["POST"]);
diff --git a/pages/api/teams/[teamId]/billing/plan.ts b/pages/api/teams/[teamId]/billing/plan.ts
index 31061802..15086c0f 100644
--- a/pages/api/teams/[teamId]/billing/plan.ts
+++ b/pages/api/teams/[teamId]/billing/plan.ts
@@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from "next";
import { getServerSession } from "next-auth/next";
import prisma from "@/lib/prisma";
import { authOptions } from "../../../auth/[...nextauth]";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -30,7 +30,7 @@ export default async function handle(
// console.log("Domains from GET", domains)
return res.status(200).json(team);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow GET and POST requests
diff --git a/pages/api/teams/[teamId]/documents/[id]/index.ts b/pages/api/teams/[teamId]/documents/[id]/index.ts
index db93fde8..f07ae1bd 100644
--- a/pages/api/teams/[teamId]/documents/[id]/index.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/index.ts
@@ -5,7 +5,7 @@ import { authOptions } from "../../../../auth/[...nextauth]";
import { CustomUser } from "@/lib/types";
import { del } from "@vercel/blob";
import { getTeamWithUsersAndDocument } from "@/lib/team/helper";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -46,7 +46,7 @@ export default async function handle(
return res.status(200).json(document);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else if (req.method === "DELETE") {
// DELETE /api/teams/:teamId/document/:id
@@ -86,7 +86,7 @@ export default async function handle(
return res.status(204).end(); // 204 No Content response for successful deletes
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow GET and DELETE requests
diff --git a/pages/api/teams/[teamId]/documents/[id]/links.ts b/pages/api/teams/[teamId]/documents/[id]/links.ts
index d6883fb3..fc9b307a 100644
--- a/pages/api/teams/[teamId]/documents/[id]/links.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/links.ts
@@ -5,7 +5,7 @@ import { authOptions } from "../../../../auth/[...nextauth]";
import { log } from "@/lib/utils";
import { CustomUser } from "@/lib/types";
import { getTeamWithUsersAndDocument } from "@/lib/team/helper";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -55,7 +55,7 @@ export default async function handle(
return res.status(200).json(links);
} catch (error) {
log(`Failed to get links for document ${docId}. Error: \n\n ${error}`);
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow GET requests
diff --git a/pages/api/teams/[teamId]/documents/[id]/stats.ts b/pages/api/teams/[teamId]/documents/[id]/stats.ts
index 23e41325..db62a49f 100644
--- a/pages/api/teams/[teamId]/documents/[id]/stats.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/stats.ts
@@ -5,7 +5,7 @@ import { authOptions } from "../../../../auth/[...nextauth]";
import { getTotalAvgPageDuration } from "@/lib/tinybird";
import { CustomUser } from "@/lib/types";
import { getTeamWithUsersAndDocument } from "@/lib/team/helper";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -57,7 +57,7 @@ export default async function handle(
return res.status(200).json(stats);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow GET requests
diff --git a/pages/api/teams/[teamId]/documents/[id]/update-name.ts b/pages/api/teams/[teamId]/documents/[id]/update-name.ts
index ef17409e..993213dd 100644
--- a/pages/api/teams/[teamId]/documents/[id]/update-name.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/update-name.ts
@@ -4,7 +4,7 @@ import prisma from "@/lib/prisma";
import { authOptions } from "@/pages/api/auth/[...nextauth]";
import { CustomUser } from "@/lib/types";
import { getTeamWithUsersAndDocument } from "@/lib/team/helper";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -46,7 +46,7 @@ export default async function handle(
return res.status(200).json({ message: "Document name updated!" });
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow POST requests
diff --git a/pages/api/teams/[teamId]/documents/[id]/views/[viewId]/stats.ts b/pages/api/teams/[teamId]/documents/[id]/views/[viewId]/stats.ts
index 4d2ec18d..75de58a1 100644
--- a/pages/api/teams/[teamId]/documents/[id]/views/[viewId]/stats.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/views/[viewId]/stats.ts
@@ -5,7 +5,7 @@ import { authOptions } from "@/pages/api/auth/[...nextauth]";
import { CustomUser } from "@/lib/types";
import prisma from "@/lib/prisma";
import { getTeamWithUsersAndDocument } from "@/lib/team/helper";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -59,7 +59,7 @@ export default async function handle(
return res.status(200).json(stats);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow GET and POST requests
diff --git a/pages/api/teams/[teamId]/documents/[id]/views/index.ts b/pages/api/teams/[teamId]/documents/[id]/views/index.ts
index a6e40d35..0f1c56f9 100644
--- a/pages/api/teams/[teamId]/documents/[id]/views/index.ts
+++ b/pages/api/teams/[teamId]/documents/[id]/views/index.ts
@@ -6,7 +6,7 @@ import { getViewPageDuration } from "@/lib/tinybird";
import { authOptions } from "@/pages/api/auth/[...nextauth]";
import { CustomUser } from "@/lib/types";
import { getTeamWithUsersAndDocument } from "@/lib/team/helper";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -103,7 +103,7 @@ export default async function handle(
return res.status(200).json(viewsWithDuration);
} catch (error) {
log(`Failed to get views for link ${docId}. Error: \n\n ${error}`);
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow GET requests
diff --git a/pages/api/teams/[teamId]/documents/index.ts b/pages/api/teams/[teamId]/documents/index.ts
index f2b3ccdc..42e37d4e 100644
--- a/pages/api/teams/[teamId]/documents/index.ts
+++ b/pages/api/teams/[teamId]/documents/index.ts
@@ -6,7 +6,7 @@ import { CustomUser } from "@/lib/types";
import { getExtension, log } from "@/lib/utils";
import { identifyUser, trackAnalytics } from "@/lib/analytics";
import { getTeamWithUsersAndDocument } from "@/lib/team/helper";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -47,7 +47,7 @@ export default async function handle(
return res.status(200).json(documents);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else if (req.method === "POST") {
// POST /api/teams/:teamId/documents
@@ -129,7 +129,7 @@ export default async function handle(
return res.status(201).json(document);
} catch (error) {
log(`Failed to create document. Error: \n\n ${error}`);
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow GET and POST requests
diff --git a/pages/api/teams/[teamId]/documents/update.ts b/pages/api/teams/[teamId]/documents/update.ts
index 829a16d8..4f02912c 100644
--- a/pages/api/teams/[teamId]/documents/update.ts
+++ b/pages/api/teams/[teamId]/documents/update.ts
@@ -5,7 +5,7 @@ import { authOptions } from "../../../auth/[...nextauth]";
import { CustomUser } from "@/lib/types";
import { getExtension, log } from "@/lib/utils";
import { getTeamWithUsersAndDocument } from "@/lib/team/helper";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -50,7 +50,7 @@ export default async function handle(
return res.status(201).json({ message: "Document updated successfully" });
} catch (error) {
log(`Failed to create document. Error: \n\n ${error}`);
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow POST requests
diff --git a/pages/api/teams/[teamId]/domains/[domain]/index.ts b/pages/api/teams/[teamId]/domains/[domain]/index.ts
index 72353091..f6b81576 100644
--- a/pages/api/teams/[teamId]/domains/[domain]/index.ts
+++ b/pages/api/teams/[teamId]/domains/[domain]/index.ts
@@ -6,7 +6,7 @@ import { log } from "@/lib/utils";
import { getApexDomain, removeDomainFromVercel } from "@/lib/domains";
import { CustomUser } from "@/lib/types";
import { getTeamWithDomain } from "@/lib/team/helper";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -66,7 +66,7 @@ export default async function handle(
return res.status(204).end(); // 204 No Content response for successful deletes
} catch (error) {
log(`Failed to delete domain: ${domain}. Error: \n\n ${error}`);
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow POST requests
diff --git a/pages/api/teams/[teamId]/domains/index.ts b/pages/api/teams/[teamId]/domains/index.ts
index 694a70d7..7f88d4cb 100644
--- a/pages/api/teams/[teamId]/domains/index.ts
+++ b/pages/api/teams/[teamId]/domains/index.ts
@@ -6,7 +6,7 @@ import { CustomUser } from "@/lib/types";
import { log } from "@/lib/utils";
import { addDomainToVercel, validDomainRegex } from "@/lib/domains";
import { identifyUser, trackAnalytics } from "@/lib/analytics";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
import { getTeamWithDomain } from "@/lib/team/helper";
export default async function handle(
@@ -42,7 +42,7 @@ export default async function handle(
const domains = team.domains;
return res.status(200).json(domains);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else if (req.method === "POST") {
// POST /api/teams/:teamId/domains
@@ -93,7 +93,7 @@ export default async function handle(
return res.status(201).json(response);
} catch (error) {
log(`Failed to add domain. Error: \n\n ${error}`);
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
// We only allow GET and POST requests
diff --git a/pages/api/teams/[teamId]/index.ts b/pages/api/teams/[teamId]/index.ts
index dcdd93ab..1505b0ef 100644
--- a/pages/api/teams/[teamId]/index.ts
+++ b/pages/api/teams/[teamId]/index.ts
@@ -3,7 +3,7 @@ import { getServerSession } from "next-auth";
import prisma from "@/lib/prisma";
import { CustomUser } from "@/lib/types";
import { authOptions } from "../../auth/[...nextauth]";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -63,7 +63,7 @@ export default async function handle(
return res.status(200).json(team);
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else if (req.method === "DELETE") {
// DELETE /api/teams/:teamId
diff --git a/pages/api/teams/[teamId]/invite.ts b/pages/api/teams/[teamId]/invite.ts
index d4753566..628ca013 100644
--- a/pages/api/teams/[teamId]/invite.ts
+++ b/pages/api/teams/[teamId]/invite.ts
@@ -4,7 +4,7 @@ import { authOptions } from "../../auth/[...nextauth]";
import { NextApiRequest, NextApiResponse } from "next";
import prisma from "@/lib/prisma";
import { CustomUser } from "@/lib/types";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
import { sendTeammateInviteEmail } from "@/lib/emails/send-teammate-invite";
export default async function handle(
@@ -79,7 +79,7 @@ export default async function handle(
return res.status(200).json("Invitation send!");
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else if (req.method === "GET") {
// GET /api/teams/:teamId/invite
@@ -142,7 +142,7 @@ export default async function handle(
return res.redirect("/documents");
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
}
}
diff --git a/pages/api/teams/[teamId]/remove-teammate.ts b/pages/api/teams/[teamId]/remove-teammate.ts
index 7bc848b3..35c03eec 100644
--- a/pages/api/teams/[teamId]/remove-teammate.ts
+++ b/pages/api/teams/[teamId]/remove-teammate.ts
@@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from "next";
import { getServerSession } from "next-auth";
import { authOptions } from "../../auth/[...nextauth]";
import { CustomUser } from "@/lib/types";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
import prisma from "@/lib/prisma";
export default async function handle(
@@ -46,7 +46,7 @@ export default async function handle(
});
return res.status(204).json("Member removed successfully!");
} catch (error) {
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
res.setHeader("Allow", ["DELETE"]);
diff --git a/pages/api/teams/[teamId]/update-name.ts b/pages/api/teams/[teamId]/update-name.ts
index ab83460d..03164cd0 100644
--- a/pages/api/teams/[teamId]/update-name.ts
+++ b/pages/api/teams/[teamId]/update-name.ts
@@ -1,7 +1,7 @@
import { NextApiRequest, NextApiResponse } from "next";
import { getServerSession } from "next-auth";
import { authOptions } from "../../auth/[...nextauth]";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
import prisma from "@/lib/prisma";
import { CustomUser } from "@/lib/types";
diff --git a/pages/api/teams/index.ts b/pages/api/teams/index.ts
index 69a1b1ac..d76782d4 100644
--- a/pages/api/teams/index.ts
+++ b/pages/api/teams/index.ts
@@ -4,7 +4,7 @@ import { authOptions } from "../auth/[...nextauth]";
import prisma from "@/lib/prisma";
import { CustomUser } from "@/lib/types";
import { log } from "@/lib/utils";
-import { errorHanlder } from "@/lib/errorHandler";
+import { errorhandler } from "@/lib/errorHandler";
export default async function handle(
req: NextApiRequest,
@@ -65,7 +65,7 @@ export default async function handle(
return res.status(200).json(teams);
} catch (error) {
log(`Failed to add domain. Error: \n\n ${error}`);
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else if (req.method === "POST") {
// POST /api/teams
@@ -95,7 +95,7 @@ export default async function handle(
return res.status(201).json(newTeam);
} catch (error) {
log(`Failed to add domain. Error: \n\n ${error}`);
- errorHanlder(error, res);
+ errorhandler(error, res);
}
} else {
res.setHeader("Allow", ["GET", "POST"]);