From ce6293d451c84b0eac6ae2d19de78715f9731fea Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Mon, 26 Apr 2021 15:56:07 +0200 Subject: [PATCH] fix(core): Display informative message when saving a translatable fails --- .../helpers/translatable-saver/translation-differ.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/core/src/service/helpers/translatable-saver/translation-differ.ts b/packages/core/src/service/helpers/translatable-saver/translation-differ.ts index 1acf268f74..8ea416d894 100644 --- a/packages/core/src/service/helpers/translatable-saver/translation-differ.ts +++ b/packages/core/src/service/helpers/translatable-saver/translation-differ.ts @@ -1,10 +1,9 @@ import { DeepPartial } from '@vendure/common/lib/shared-types'; import { RequestContext } from '../../../api/common/request-context'; -import { EntityNotFoundError } from '../../../common/error/errors'; +import { InternalServerError } from '../../../common/error/errors'; import { Translatable, Translation, TranslationInput } from '../../../common/types/locale-types'; import { foundIn, not } from '../../../common/utils'; -import { ProductOptionGroup } from '../../../entity/product-option-group/product-option-group.entity'; import { TransactionalConnection } from '../../transaction/transactional-connection'; export type TranslationContructor = new ( @@ -72,9 +71,7 @@ export class TranslationDiffer { .getRepository(ctx, this.translationCtor) .save(translation as any); } catch (err) { - const entityName = entity.constructor.name; - const id = (entity as any).id || 'undefined'; - throw new EntityNotFoundError(entityName as any, id); + throw new InternalServerError(err.message); } entity.translations.push(newTranslation); }