Skip to content

Commit

Permalink
fix error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
SamratSahoo committed Mar 7, 2024
1 parent 040ea37 commit 2be9f00
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/src/controllers/events/click-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const clickEventRoute = APIWrapper({
const limit = req.query.limit ?? 10
const afterTime = req.query.afterTime ? new Date(req.query.afterTime as string) : new Date(Date.now() - 60 * 60 * 24 * 30 * 1000)
if (!projectName) {
throw new Error("You must specify a project name to create a project!")
throw new Error("You must specify a project name!")
}
const events: ClickEvent[] = await paginatedGetClickEvents(afterTime, afterId as string, parseInt(limit as string), projectName as string);
return {
Expand Down
2 changes: 1 addition & 1 deletion api/src/controllers/events/custom-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const customEventRoute = APIWrapper({
const limit = req.query.limit ?? 10
const afterTime = req.query.afterTime ? new Date(req.query.afterTime as string) : new Date(Date.now() - 60 * 60 * 24 * 30 * 1000)
if (!projectName) {
throw new Error("You must specify a project name to create a project!")
throw new Error("You must specify a project name!")
}
const events = await paginatedGetCustomEvents(eventType.toString(), afterTime, afterId as string, parseInt(limit as string));
return {
Expand Down
4 changes: 2 additions & 2 deletions api/src/controllers/events/input-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const inputEventRoute = APIWrapper({
const { objectId, userId, textValue } = req.body;

if (!objectId || !userId || !textValue) {
throw new Error("You must specify a project name to create a project!")
throw new Error("You must specify an objectId, userId, and textValue!")
}

const project = await getProjectByClientKey(req.headers.clienttoken as string);
Expand Down Expand Up @@ -45,7 +45,7 @@ const inputEventRoute = APIWrapper({
const limit = req.query.limit ?? 10
const afterTime = req.query.afterTime ? new Date(req.query.afterTime as string) : new Date(Date.now() - 60 * 60 * 24 * 30 * 1000)
if (!projectName) {
throw new Error("You must specify a project name to create a project!")
throw new Error("You must specify a project name!")
}
const events: InputEvent[] = await paginatedGetInputEvents(afterTime, afterId as string, parseInt(limit as string), projectName as string);
return {
Expand Down
8 changes: 4 additions & 4 deletions api/src/controllers/events/visit-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const visitEventRoute = APIWrapper({
requireClientToken: true,
},
handler: async (req: Request) => {
const { pageUrl, userId, date } = req.body;
const { pageUrl, userId } = req.body;

if (!pageUrl || !userId || !date) {
throw new Error("You must specify a project name to create a project!")
if (!pageUrl || !userId) {
throw new Error("You must specify a pageUrl and userId!")
}
const project = await getProjectByClientKey(req.headers.clienttoken as string);

Expand Down Expand Up @@ -43,7 +43,7 @@ const visitEventRoute = APIWrapper({
const limit = req.query.limit ?? 10
const afterTime = req.query.afterTime ? new Date(req.query.afterTime as string) : new Date(Date.now() - 60 * 60 * 24 * 30 * 1000)
if (!projectName) {
throw new Error("You must specify a project name to create a project!")
throw new Error("You must specify a project name!")
}
const events: VisitEvent[] = await paginatedGetVisitEvents(afterTime, afterId as string, parseInt(limit as string), projectName as string);
return {
Expand Down

0 comments on commit 2be9f00

Please sign in to comment.