Skip to content

Commit

Permalink
feat: improve standard error msg
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Sep 24, 2023
1 parent 79d3384 commit 27ad530
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/controllers/audit.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const findAll = async (req, res) => {
res.status(400).json({
message: 'Can not retreive audit data',
error: error.message,
success: false,
});
}
};
Expand All @@ -33,6 +34,7 @@ export const findConflicts = async (req, res) => {
res.status(400).json({
message: 'Can not retreive audit data',
error: error.message,
success: false,
});
}
};
7 changes: 7 additions & 0 deletions src/controllers/fileStore.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const subscribeToFileStore = (req, res) => {
res.status(400).json({
message: `Can not subscribe to file store.`,
error: error.message,
success: false,
});
}
};
Expand All @@ -31,6 +32,7 @@ export const unsubscribeFromFileStore = (req, res) => {
res.status(400).json({
message: 'Can not retrieve file list from filestore',
error: error.message,
success: false,
});
}
};
Expand All @@ -43,6 +45,7 @@ export const getFileList = async (req, res) => {
res.status(400).json({
message: 'Can not retrieve file list from filestore',
error: error.message,
success: false,
});
}
};
Expand All @@ -58,6 +61,7 @@ export const deleteFile = async (req, res) => {
res.status(400).json({
message: 'Can not delete file from filestore',
error: error.message,
success: false,
});
}
};
Expand All @@ -72,12 +76,14 @@ export const getFile = async (req, res) => {
} else {
res.status(400).json({
message: `FileId ${fileId} not found in the filestore.`,
success: false,
});
}
} catch (error) {
res.status(400).json({
message: 'Can not retreive file list from filestore',
error: error.message,
success: false,
});
}
};
Expand Down Expand Up @@ -112,6 +118,7 @@ export const addFileToFileStore = async (req, res) => {
res.status(400).json({
message: 'Can not add file to file store',
error: error.message,
success: false,
});
}
};
10 changes: 10 additions & 0 deletions src/controllers/governance.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const findAll = async (req, res) => {
res.status(400).json({
message: 'Can not retreive Governance Data',
error: error.message,
success: false,
});
}
};
Expand All @@ -46,6 +47,7 @@ export const isCreated = async (req, res) => {
res.status(400).json({
message: 'Can not retreive Governance Data',
error: error.message,
success: false,
});
}
};
Expand All @@ -58,6 +60,7 @@ export const findOrgList = async (req, res) => {
res.status(400).json({
message: 'Can not retreive Governance Data',
error: error.message,
success: false,
});
}
};
Expand All @@ -76,6 +79,7 @@ export const findGlossary = async (req, res) => {
res.status(400).json({
message: 'Can not retreive Governance Data',
error: error.message,
success: false,
});
}
};
Expand All @@ -95,6 +99,7 @@ export const findPickList = async (req, res) => {
res.status(400).json({
message: 'Can not retreive Governance Data',
error: error.message,
success: false,
});
}
};
Expand All @@ -116,6 +121,7 @@ export const createGoveranceBody = async (req, res) => {
res.status(400).json({
message: 'Cant create Governance Body',
error: error.message,
success: false,
});
}
};
Expand All @@ -141,6 +147,7 @@ export const setDefaultOrgList = async (req, res) => {
res.status(400).json({
message: 'Cant update default orgs',
error: error.message,
success: false,
});
}
};
Expand All @@ -165,6 +172,7 @@ export const setPickList = async (req, res) => {
res.status(400).json({
message: 'Cant update picklist',
error: error.message,
success: false,
});
}
};
Expand All @@ -188,6 +196,7 @@ export const setGlossary = async (req, res) => {
res.status(400).json({
message: 'Cant update glossary',
error: error.message,
success: false,
});
}
};
Expand All @@ -202,6 +211,7 @@ export const sync = async (req, res) => {
res.status(400).json({
message: 'Cant Sync Governance Body',
error: error.message,
success: false,
});
}
};
1 change: 1 addition & 0 deletions src/controllers/issuance.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const findAll = async (req, res) => {
res.status(400).json({
message: 'Can not retreive issuances',
error: error.message,
success: false,
});
}
};
1 change: 1 addition & 0 deletions src/controllers/label.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const findAll = async (req, res) => {
res.status(400).json({
message: 'Can not retreive labels',
error: error.message,
success: false,
});
}
};
6 changes: 6 additions & 0 deletions src/controllers/offer.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const generateOfferFile = async (req, res) => {
res.status(400).json({
message: 'Error generating offer file.',
error: error.message,
success: false,
});
}
};
Expand Down Expand Up @@ -67,6 +68,7 @@ export const cancelActiveOffer = async (req, res) => {
res.status(400).json({
message: 'Can not cancel active offer',
error: error.message,
success: false,
});
}
};
Expand Down Expand Up @@ -106,6 +108,7 @@ export const importOfferFile = async (req, res) => {
res.status(400).json({
message: 'Can not import offer file.',
error: error.message,
success: false,
});
}
};
Expand Down Expand Up @@ -140,6 +143,7 @@ export const commitImportedOfferFile = async (req, res) => {
res.status(400).json({
message: 'Can not commit offer.',
error: error.message,
success: false,
});
}
};
Expand All @@ -157,6 +161,7 @@ export const cancelImportedOfferFile = async (req, res) => {
res.status(400).json({
message: 'Can not cancel offer.',
error: error.message,
success: false,
});
}
};
Expand Down Expand Up @@ -231,6 +236,7 @@ export const getCurrentOfferInfo = async (req, res) => {
res.status(400).json({
message: 'Can not get offer.',
error: error.message,
success: false,
});
}
};
15 changes: 15 additions & 0 deletions src/controllers/organization.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const editHomeOrg = async (req, res) => {
res.status(400).json({
message: 'Error initiating your organization',
error: error.message,
success: false,
});
}
};
Expand Down Expand Up @@ -86,6 +87,7 @@ export const createV2 = async (req, res) => {
res.status(400).json({
message: 'Error initiating your organization',
error: error.message,
success: false,
});
}
};
Expand Down Expand Up @@ -119,6 +121,7 @@ export const create = async (req, res) => {
res.status(400).json({
message: 'Error initiating your organization',
error: error.message,
success: false,
});
}
};
Expand All @@ -143,6 +146,7 @@ export const resetHomeOrg = async (req, res) => {
res.status(400).json({
message: 'Error resetting your organization',
error: error.message,
success: false,
});
}
};
Expand All @@ -165,6 +169,7 @@ export const importOrg = async (req, res) => {
res.status(400).json({
message: 'Error importing organization',
error: error.message,
success: false,
});
}
};
Expand All @@ -186,6 +191,7 @@ export const importHomeOrg = async (req, res) => {
res.status(400).json({
message: 'Error importing organization',
error: error.message,
success: false,
});
}
};
Expand All @@ -205,6 +211,7 @@ export const subscribeToOrganization = async (req, res) => {
res.status(400).json({
message: 'Error subscribing to organization',
error: error.message,
success: false,
});
}
};
Expand Down Expand Up @@ -239,6 +246,7 @@ export const deleteImportedOrg = async (req, res) => {
res.status(400).json({
message: 'Error unsubscribing to organization',
error: error.message,
success: false,
});
if (transaction) {
await transaction.rollback();
Expand Down Expand Up @@ -278,6 +286,7 @@ export const unsubscribeToOrganization = async (req, res) => {
res.status(400).json({
message: 'Error unsubscribing to organization',
error: error.message,
success: false,
});

if (transaction) {
Expand Down Expand Up @@ -317,6 +326,7 @@ export const resyncOrganization = async (req, res) => {
res.status(400).json({
message: 'Error resyncing organization',
error: error.message,
success: false,
});

if (transaction) {
Expand All @@ -341,6 +351,7 @@ export const addMetadata = async (req, res) => {
res.status(400).json({
message: 'Error adding metadata to your organization',
error: error.message,
success: false,
});
}
};
Expand All @@ -359,6 +370,7 @@ export const addMirror = async (req, res) => {
res.status(400).json({
message: 'Error adding mirror',
error: error.message,
success: false,
});
}
};
Expand All @@ -376,6 +388,7 @@ export const getMetaData = async (req, res) => {
res.status(400).json({
message: 'Error getting metadata for organization',
error: error.message,
success: false,
});
}
};
Expand All @@ -393,6 +406,7 @@ export const removeMirror = async (req, res) => {
} catch (error) {
res.status(400).json({
message: 'Error removing mirror for organization',
success: false,
});
}
};
Expand All @@ -407,6 +421,7 @@ export const sync = async (req, res) => {
res.status(400).json({
message: 'Cant All Organizations Metadata',
error: error.message,
success: false,
});
}
};
8 changes: 8 additions & 0 deletions src/controllers/project.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const create = async (req, res) => {
res.status(400).json({
message: 'Error creating new project',
error: err.message,
success: false,
});
}
};
Expand Down Expand Up @@ -248,6 +249,7 @@ export const findAll = async (req, res) => {
res.status(400).json({
message: 'Error retrieving projects',
error: error.message,
success: false,
});
}
};
Expand All @@ -266,6 +268,7 @@ export const findOne = async (req, res) => {
res.status(400).json({
message: 'Error retrieving projects',
error: error.message,
success: false,
});
}
};
Expand Down Expand Up @@ -294,6 +297,7 @@ export const updateFromXLS = async (req, res) => {
res.status(400).json({
message: 'Batch Upload Failed.',
error: error.message,
success: false,
});
}
};
Expand All @@ -305,6 +309,7 @@ export const transfer = async (req, res) => {
} catch (err) {
res.status(400).json({
message: err.message,
success: false,
});
logger.error('Error adding update to stage', err);
}
Expand Down Expand Up @@ -404,6 +409,7 @@ const update = async (req, res, isTransfer = false) => {
} catch (err) {
res.status(400).json({
message: err.message,
success: false,
});
logger.error('Error adding update to stage', err);
}
Expand Down Expand Up @@ -438,6 +444,7 @@ export const destroy = async (req, res) => {
res.status(400).json({
message: 'Error adding project removal to stage',
error: err.message,
success: false,
});
}
};
Expand All @@ -460,6 +467,7 @@ export const batchUpload = async (req, res) => {
res.status(400).json({
message: 'Batch Upload Failed.',
error: error.message,
success: false,
});
}
};
Loading

0 comments on commit 27ad530

Please sign in to comment.