Skip to content

Commit

Permalink
edited create-personal-conversation.ts errors (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlehDulebaEpam authored Nov 28, 2023
1 parent 4d4c0aa commit a952612
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/functions/create-personal-conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const handler = async (event: APIGatewayProxyEventV2) => {
return {
statusCode: 400,
body: JSON.stringify({
type: "InvalidUserDataException",
message:
'Header should contain "rs-email", "rs-uid" and "Authorization" parameters.',
}),
Expand All @@ -36,6 +37,7 @@ export const handler = async (event: APIGatewayProxyEventV2) => {
return {
statusCode: 400,
body: JSON.stringify({
type: "InvalidTokenException",
message:
'Header should contain "Authorization" parameter with Bearer code.',
}),
Expand All @@ -59,6 +61,7 @@ export const handler = async (event: APIGatewayProxyEventV2) => {
return {
statusCode: 400,
body: JSON.stringify({
type: "InvalidFormDataException",
message: "Invalid multipart/form-data request",
}),
};
Expand Down Expand Up @@ -91,14 +94,18 @@ export const handler = async (event: APIGatewayProxyEventV2) => {
} else {
return {
statusCode: 400,
body: JSON.stringify("Invalid post data"),
body: JSON.stringify({
type: "InvalidFormDataException",
message: "Invalid post data",
}),
};
}

if (!data.companion) {
return {
statusCode: 400,
body: JSON.stringify({
type: "InvalidFormDataException",
message: 'Parameter "companion" should be defined.',
}),
};
Expand Down

0 comments on commit a952612

Please sign in to comment.