add better error handling for photo upload
This commit is contained in:
parent
2be3d16365
commit
6253668e8a
@ -51,6 +51,13 @@ const handler: NextApiHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await uploadPhoto;
|
||||||
|
} catch (error) {
|
||||||
|
res.writeHead(500, JSON.stringify((error as Error).message)).end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const photoBuffer = fs.readFileSync((await uploadPhoto).filepath);
|
const photoBuffer = fs.readFileSync((await uploadPhoto).filepath);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user