From 03911d539ab964729ad700993d7df09d24452c64 Mon Sep 17 00:00:00 2001 From: Greg Pabian <35925521+grzpab@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:58:34 +0100 Subject: [PATCH] fix --- src/data/readHomeDirectoryCases.ts | 16 ++++++++++++---- src/extension.ts | 14 +++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/data/readHomeDirectoryCases.ts b/src/data/readHomeDirectoryCases.ts index a4dea460..3ba7b6f5 100644 --- a/src/data/readHomeDirectoryCases.ts +++ b/src/data/readHomeDirectoryCases.ts @@ -66,13 +66,15 @@ const readHomeDirectoryCase = async ( if ( !surfaceAgnosticCase.absoluteTargetPath.startsWith(rootUri.fsPath) ) { - console.log('HERE1'); + console.info( + 'The current case does not belong to the opened workspace', + ); fileEventEmitter.emit('close'); return; } if (!caseHashCodec.is(surfaceAgnosticCase.caseHashDigest)) { - console.log('HERE2'); + console.error('Could not validate the case hash digest'); fileEventEmitter.emit('close'); return; } @@ -94,8 +96,14 @@ const readHomeDirectoryCase = async ( const jobHandler = (data: unknown) => { const surfaceAgnosticJob = parseSurfaceAgnosticJob(data); - if (!kase || !jobHashCodec.is(surfaceAgnosticJob.jobHashDigest)) { - console.log('HERE3'); + if (!kase) { + console.error('You need to have a case to create a job'); + fileEventEmitter.emit('close'); + return; + } + + if (!jobHashCodec.is(surfaceAgnosticJob.jobHashDigest)) { + console.error('Could not validate the job hash digest'); fileEventEmitter.emit('close'); return; } diff --git a/src/extension.ts b/src/extension.ts index e92f1da8..44362eb9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,7 +5,7 @@ import { buildContainer } from './container'; import { Command, MessageBus, MessageKind } from './components/messageBus'; import { JobManager } from './components/jobManager'; import { FileService } from './components/fileService'; -import { Case, CaseHash, caseHashCodec } from './cases/types'; +import { CaseHash, caseHashCodec } from './cases/types'; import { DownloadService } from './components/downloadService'; import { FileSystemUtilities } from './components/fileSystemUtilities'; import { EngineService } from './components/engineService'; @@ -45,11 +45,7 @@ import { } from './data/codemodConfigSchema'; import { parsePrivateCodemodsEnvelope } from './data/privateCodemodsEnvelopeSchema'; import { GlobalStateTokenStorage, UserService } from './components/userService'; -import { - HomeDirectoryService, - readHomeDirectoryCases, -} from './data/readHomeDirectoryCases'; -import { Job } from './jobs/types'; +import { HomeDirectoryService } from './data/readHomeDirectoryCases'; export const enum SEARCH_PARAMS_KEYS { ENGINE = 'engine', @@ -1264,11 +1260,7 @@ export async function activate(context: vscode.ExtensionContext) { kind: MessageKind.bootstrapEngine, }); - const homeDirectoryService = new HomeDirectoryService( - messageBus, - store, - rootUri, - ); + new HomeDirectoryService(messageBus, store, rootUri); messageBus.publish({ kind: MessageKind.loadHomeDirectoryData,