From 0e94391b4730bdcdc2889909ca16bdefdcc86cd0 Mon Sep 17 00:00:00 2001 From: Golda Velez Date: Wed, 11 Jan 2023 03:30:02 -0700 Subject: [PATCH 1/2] check for missing did error and provide helpful error message --- packages/devtools/src/composite.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/devtools/src/composite.ts b/packages/devtools/src/composite.ts index e831a4d62..5291950fa 100644 --- a/packages/devtools/src/composite.ts +++ b/packages/devtools/src/composite.ts @@ -1,5 +1,7 @@ import type { CeramicApi, SignedCommit } from '@ceramicnetwork/common' +import type { MisingDIDError } from '@ceramicnetwork/http-client' import { Model, type ModelViewsDefinition } from '@ceramicnetwork/stream-model' + import { StreamID } from '@ceramicnetwork/streamid' import type { CompositeViewsDefinition, @@ -541,11 +543,16 @@ export class Composite { /** * Configure the Ceramic node to index the models defined in the composite. An authenticated DID - * set as admin in the Ceramic node configuration must be attached to the Ceramic instance. + * set as admin in the Ceramic node configuration must be attached to the Ceramic instance, otherwise + * an error is thrown. */ async startIndexingOn(ceramic: CeramicApi): Promise { const modelIDs = Object.keys(this.#definition.models).map(StreamID.fromString) - await ceramic.admin.startIndexingModels(modelIDs) + try { + await ceramic.admin.startIndexingModels(modelIDs) + } catch(e: MissingDIDError) { + throw new Error(`${e.message}: is the environment variable DID_PRIVATE_KEY set to a valid DID?`) + } } /** From 99c6e7475e12d1398a7e2f2780da34ad6ac8c28b Mon Sep 17 00:00:00 2001 From: Golda Velez Date: Tue, 21 Feb 2023 20:21:40 -0700 Subject: [PATCH 2/2] fix import --- packages/devtools/src/composite.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/devtools/src/composite.ts b/packages/devtools/src/composite.ts index 5291950fa..90024b4b4 100644 --- a/packages/devtools/src/composite.ts +++ b/packages/devtools/src/composite.ts @@ -1,5 +1,5 @@ import type { CeramicApi, SignedCommit } from '@ceramicnetwork/common' -import type { MisingDIDError } from '@ceramicnetwork/http-client' +import type { MissingDIDError } from '@ceramicnetwork/http-client' import { Model, type ModelViewsDefinition } from '@ceramicnetwork/stream-model' import { StreamID } from '@ceramicnetwork/streamid'