From 4c8f006ebacbfc5cd50d9e94c17ec6cdf612b559 Mon Sep 17 00:00:00 2001 From: Fran Mendez Date: Tue, 13 Jul 2021 19:13:34 +0200 Subject: [PATCH] chore: log message when no functions dir is found --- src/lib/runtimes/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/runtimes/index.js b/src/lib/runtimes/index.js index 398bfa991..4fb39670c 100644 --- a/src/lib/runtimes/index.js +++ b/src/lib/runtimes/index.js @@ -4,7 +4,7 @@ import { stat } from 'fs/promises' import walkdir from 'walkdir' import { runJS } from './js.js' import { generateAndStartServer, runJava } from './java.js' -import { logError, logWarningMessage } from '../logger.js' +import { logError, logInfoMessage, logWarningMessage } from '../logger.js' import { functions } from '../functions.js' import Glee from '../glee.js' import experimentalFlags from '../experimentalFlags.js' @@ -68,7 +68,15 @@ export async function triggerFunction({ export async function startRuntimeServers(dir, asyncapiFilePath) { try { - const files = await walkdir.async(dir, { return_object: true }) + let files + + try { + files = await walkdir.async(dir, { return_object: true }) + } catch (e) { + logInfoMessage('No functions directory found.') + return + } + const runtimes = {} await Promise.all(Object.keys(files).map(async (filePath) => {