From 1b0966ea61271332a0859d99d22a6ce7723f46d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 25 Apr 2024 13:18:46 +0200 Subject: [PATCH] promise reject on create failure --- .../structure/content-type-structure-manager.class.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/content-type/structure/content-type-structure-manager.class.ts b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/structure/content-type-structure-manager.class.ts index a4b7176829..14f7dc9ef1 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/content-type/structure/content-type-structure-manager.class.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/content-type/structure/content-type-structure-manager.class.ts @@ -120,18 +120,18 @@ export class UmbContentTypeStructureManager< */ public async create(parentUnique: string | null) { const contentType = this.getOwnerContentType(); - if (!contentType || !contentType.unique) return false; + if (!contentType || !contentType.unique) { + throw new Error('Could not find the Content Type to create'); + } const { data } = await this.#repository.create(contentType, parentUnique); - if (!data) return false; + if (!data) return Promise.reject(); // Update state with latest version: this.#contentTypes.updateOne(contentType.unique, data); // Start observe the new content type in the store, as we did not do that when it was a scaffold/local-version. this._observeContentType(data); - - return true; } private async _loadContentTypeCompositions(contentType: T) {