Skip to content

Commit

Permalink
chore: log message when no functions dir is found
Browse files Browse the repository at this point in the history
  • Loading branch information
fmvilas committed Jul 13, 2021
1 parent bd46911 commit 4c8f006
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib/runtimes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 4c8f006

Please sign in to comment.