diff --git a/common/changes/@itwin/core-backend/imodel-not-open-404_2022-03-10-14-47.json b/common/changes/@itwin/core-backend/imodel-not-open-404_2022-03-10-14-47.json new file mode 100644 index 000000000000..99b35bb89b62 --- /dev/null +++ b/common/changes/@itwin/core-backend/imodel-not-open-404_2022-03-10-14-47.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/core-backend", + "comment": "", + "type": "none" + } + ], + "packageName": "@itwin/core-backend" +} \ No newline at end of file diff --git a/common/changes/@itwin/core-common/imodel-not-open-404_2022-03-10-14-47.json b/common/changes/@itwin/core-common/imodel-not-open-404_2022-03-10-14-47.json new file mode 100644 index 000000000000..d1ac065f5d72 --- /dev/null +++ b/common/changes/@itwin/core-common/imodel-not-open-404_2022-03-10-14-47.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/core-common", + "comment": "", + "type": "none" + } + ], + "packageName": "@itwin/core-common" +} \ No newline at end of file diff --git a/core/backend/src/rpc-impl/RpcBriefcaseUtility.ts b/core/backend/src/rpc-impl/RpcBriefcaseUtility.ts index 2480fe43f7aa..364ae6951bfb 100644 --- a/core/backend/src/rpc-impl/RpcBriefcaseUtility.ts +++ b/core/backend/src/rpc-impl/RpcBriefcaseUtility.ts @@ -113,9 +113,7 @@ export class RpcBriefcaseUtility { * @param the IModelRpcProps to locate the opened iModel. */ public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) { - const iModelDb = IModelDb.tryFindByKey(iModel.key); - if (undefined === iModelDb) - throw new IModelError(IModelStatus.NotOpen, "iModel is not opened", () => iModel); + const iModelDb = IModelDb.findByKey(iModel.key); // call reattach, just in case this is a V2 checkpoint whose accessToken is about to expire. await iModelDb.reattachDaemon(accessToken); diff --git a/core/common/src/rpc/core/RpcInvocation.ts b/core/common/src/rpc/core/RpcInvocation.ts index cd073c87690d..312b5fd2d9b7 100644 --- a/core/common/src/rpc/core/RpcInvocation.ts +++ b/core/common/src/rpc/core/RpcInvocation.ts @@ -216,15 +216,12 @@ export class RpcInvocation { const result = await RpcMarshaling.serialize(this.protocol, reason); - let isNoContentError = false; - try { isNoContentError = reason.errorNumber === IModelStatus.NoContent; } catch { } - if (reason instanceof RpcPendingResponse) { this._pending = true; this._threw = false; result.objects = reason.message; this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedPending, this); - } else if (this.supportsNoContent() && isNoContentError) { + } else if (this.supportsNoContent() && reason?.errorNumber === IModelStatus.NoContent) { this._noContent = true; this._threw = false; this.protocol.events.raiseEvent(RpcProtocolEvent.BackendReportedNoContent, this);