fix parseUploadErrorCodes issue
This commit is contained in:
parent
7640198945
commit
3b183bbb00
|
@ -24,7 +24,7 @@ import { getAllFacesFromMap } from 'utils/machineLearning';
|
||||||
import { MLFactory } from './machineLearningFactory';
|
import { MLFactory } from './machineLearningFactory';
|
||||||
import mlIDbStorage from 'utils/storage/mlIDbStorage';
|
import mlIDbStorage from 'utils/storage/mlIDbStorage';
|
||||||
import { getMLSyncConfig } from 'utils/machineLearning/config';
|
import { getMLSyncConfig } from 'utils/machineLearning/config';
|
||||||
import { CustomError, parseServerError } from 'utils/error';
|
import { CustomError, parseUploadErrorCodes } from 'utils/error';
|
||||||
import { MAX_ML_SYNC_ERROR_COUNT } from 'constants/machineLearning/config';
|
import { MAX_ML_SYNC_ERROR_COUNT } from 'constants/machineLearning/config';
|
||||||
import FaceService from './faceService';
|
import FaceService from './faceService';
|
||||||
import PeopleService from './peopleService';
|
import PeopleService from './peopleService';
|
||||||
|
@ -379,8 +379,8 @@ class MachineLearningService {
|
||||||
error
|
error
|
||||||
);
|
);
|
||||||
if ('status' in error) {
|
if ('status' in error) {
|
||||||
const parsedMessage = parseServerError(error);
|
const parsedMessage = parseUploadErrorCodes(error);
|
||||||
error = parsedMessage ? new Error(parsedMessage) : error;
|
error = parsedMessage;
|
||||||
}
|
}
|
||||||
// TODO: throw errors not related to specific file
|
// TODO: throw errors not related to specific file
|
||||||
// sync job run should stop after these errors
|
// sync job run should stop after these errors
|
||||||
|
|
|
@ -51,7 +51,7 @@ export enum CustomError {
|
||||||
UNKNOWN_ERROR = 'Something went wrong, please try again',
|
UNKNOWN_ERROR = 'Something went wrong, please try again',
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseUploadErrorCodes(error) {
|
export function parseUploadErrorCodes(error) {
|
||||||
let parsedMessage = null;
|
let parsedMessage = null;
|
||||||
if (error?.status) {
|
if (error?.status) {
|
||||||
const errorCode = error.status.toString();
|
const errorCode = error.status.toString();
|
||||||
|
|
Loading…
Reference in a new issue