MCPcopy Create free account
hub / github.com/vercel/vercel / assertValidCwd

Function assertValidCwd

packages/cli-exec/src/errors.ts:102–113  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

100 * Verifies that the resolved working directory exists and is a directory.
101 */
102export async function assertValidCwd(cwd: string) {
103 try {
104 if (!(await stat(cwd)).isDirectory()) {
105 throw new Error('not a directory');
106 }
107 } catch {
108 throw new VercelCliError({
109 code: 'VERCEL_CLI_INVALID_CWD',
110 message: `Working directory ${JSON.stringify(cwd)} does not exist or is not a directory.`,
111 });
112 }
113}
114
115/**
116 * Converts errors from `execa` into stable `VercelCliError` instances.

Callers 1

execVercelCliFunction · 0.90

Calls 2

statFunction · 0.85
isDirectoryMethod · 0.45

Tested by

no test coverage detected