-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added error logs only and for the api errors showing only the selecte…
…d fields, removed the error handler and updated the entry migration script
- Loading branch information
Showing
7 changed files
with
90 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 12 additions & 14 deletions
26
packages/contentstack-migration/src/utils/error-handler.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
'use strict'; | ||
|
||
const { error } = require('./logger'); | ||
const { errorMessageHandler } = require('./constants'); | ||
|
||
module.exports = (data, type, method, err) => { | ||
if (data && type && method) { | ||
error(`Error occurred while ${errorMessageHandler[method]} ${type}: ${data}.`); | ||
} | ||
|
||
if (err.errorMessage) { | ||
error(err.errorMessage); | ||
} | ||
if (err instanceof Error && err && err.message && err.stack) { | ||
error(err.message); | ||
// error(err.stack) | ||
} else { | ||
error(err); | ||
} | ||
// NOTE: Commenting this code as the API errors are handled through error-helper.js also | ||
// if (data && type && method) { | ||
// logger.log('error', { error: `Error occurred while ${errorMessageHandler[method]} ${type}: ${data}.` }); | ||
// } | ||
// if (err.errorMessage) { | ||
// logger.log('error', { errorAPI: err.errorMessage }); | ||
// } | ||
// if (err instanceof Error && err && err.message && err.stack) { | ||
// logger.log('error', { error: err.message }); | ||
// } else { | ||
// logger.log('error', { error: err }); | ||
// } | ||
// throw new Error(err); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters