Skip to content

Commit f0d7925

Browse files
committed
#1550 - put errors[] in error msg, make toast display longer
1 parent b98a441 commit f0d7925

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/backend/src/utils/google-integration.utils.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,15 @@ export const uploadFile = async (fileObject: Express.Multer.File) => {
100100
});
101101
const { id, name } = response.data;
102102
return { id, name };
103-
} catch (error: unknown) {
104-
if (error instanceof Error) {
103+
} catch (error: any) {
104+
if (error.errors) {
105+
throw new HttpException(
106+
error.code,
107+
`Failed to Upload Receipt(s): ${error.message}, ${error.errors.reduce((acc: any, curr: any) => {
108+
return acc + ' ' + curr.message + ' ' + curr.reason;
109+
}, '')}`
110+
);
111+
} else if (error instanceof Error) {
105112
throw new HttpException(500, `Failed to Upload Receipt(s): ${error.message}`);
106113
}
107114
console.log('error' + error);

src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementRequestForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const ReimbursementRequestForm: React.FC<ReimbursementRequestFormProps> = ({
160160
history.push(routes.FINANCE + '/' + reimbursementRequestId);
161161
} catch (e: unknown) {
162162
if (e instanceof Error) {
163-
toast.error(e.message, 3000);
163+
toast.error(e.message, 5000);
164164
}
165165
}
166166
};

0 commit comments

Comments
 (0)