Improved error logging for member CSV import

no issue

- Error object can be an array in case of database constrain validation errors, for this reason need to distinguish between singular objects and an array. This handling resemles the one in common error-handler - https://github.com/TryGhost/Ghost/blob/3.5.0/core/server/web/shared/middlewares/error-handler.js#L31-L33
This commit is contained in:
Nazar Gargol 2020-02-10 16:25:56 +08:00
parent 019605e9e0
commit 42f4518a63

View File

@ -342,7 +342,12 @@ const members = {
} else {
// NOTE: if the error happens as a result of pure API call it doesn't get logged anywhere
// for this reason we have to make sure any unexpected errors are logged here
common.logging.error(inspection.reason());
if (Array.isArray(inspection.reason())) {
common.logging.error(inspection.reason()[0]);
} else {
common.logging.error(inspection.reason());
}
invalid = invalid + 1;
}
}