From 8facd5c9effdac6146406fc2073250dadfa8228b Mon Sep 17 00:00:00 2001 From: Ahmed Zamil Date: Sun, 10 Aug 2025 23:12:44 +0300 Subject: [PATCH] Warehouse --- src/Resource/Warehouse.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Resource/Warehouse.js b/src/Resource/Warehouse.js index 2ce5606..b35b291 100644 --- a/src/Resource/Warehouse.js +++ b/src/Resource/Warehouse.js @@ -43,6 +43,8 @@ import IRecord from '../Data/IRecord.js'; import TemplateType from './Template/TemplateType.js'; import DistributedResource from '../Net/IIP/DistributedResource.js'; import IEnum from '../Data/IEnum.js'; +import AsyncException from '../Core/AsyncException.js'; +import ExceptionCode from '../Core/ExceptionCode.js'; export class WH extends IEventHandler { @@ -212,8 +214,12 @@ export class WH extends IEventHandler async put(name, resource, store, parent, customTemplate = null, age = 0, manager = null, attributes = null){ - if (resource.instance != null) - throw new Error("Resource has a store."); + let rt = new AsyncReply(); + + if (resource.instance != null){ + rt.triggerError(new AsyncException(0, ExceptionCode.GeneralFailure, "Resource has a store")); + return rt; + } let path = name.replace(/^\\/g, "").split("/");