Skip to content

Commit

Permalink
fix: adds logs to better catch upload excel issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ec2sw committed Jul 13, 2022
1 parent 47a4b1a commit 4329ad5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/controllers/project.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export const updateFromXLS = async (req, res) => {
message: 'Updates from xlsx added to staging',
});
} catch (error) {
logger.error(error);
res.status(400).json({
message: 'Batch Upload Failed.',
error: error.message,
Expand Down Expand Up @@ -368,6 +369,7 @@ export const batchUpload = async (req, res) => {
'CSV processing complete, your records have been added to the staging table.',
});
} catch (error) {
logger.error('Batch Upload Failed.', error);
res.status(400).json({
message: 'Batch Upload Failed.',
error: error.message,
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/units.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
} from '../utils/xls';

import { formatModelAssociationName } from '../utils/model-utils.js';
import { logger } from '../config/logger.cjs';

export const create = async (req, res) => {
try {
Expand Down Expand Up @@ -245,6 +246,7 @@ export const updateFromXLS = async (req, res) => {
message: 'Updates from xlsx added to staging',
});
} catch (error) {
logger.error('Batch Upload Failed.', error);
res.status(400).json({
message: 'Batch Upload Failed.',
error: error.message,
Expand Down Expand Up @@ -456,6 +458,7 @@ export const batchUpload = async (req, res) => {
'CSV processing complete, your records have been added to the staging table.',
});
} catch (error) {
logger.error('Batch Upload Failed.', error);
res.status(400).json({
message: 'Batch Upload Failed.',
error: error.message,
Expand Down

0 comments on commit 4329ad5

Please sign in to comment.