Class: PathDeniedError
Defined in: packages/sdk/src/permissions.ts:42
Thrown by FileService and ProcessService when an extension touches a path — or runs a process with a working directory — outside the open workspace without the matching Permission. Catch it and degrade gracefully, the same way you'd handle a missing file:
try {
const text = await ctx.files.readText(path);
} catch (err) {
if (err instanceof PathDeniedError) showMessage("That file is outside the workspace.");
}Extends
Error
Constructors
Constructor
new PathDeniedError(path, message?): PathDeniedError;Defined in: packages/sdk/src/permissions.ts:46
Parameters
path
string
message?
string
Returns
PathDeniedError
Overrides
Error.constructorProperties
path
readonly path: string;Defined in: packages/sdk/src/permissions.ts:44
The offending path, exactly as the extension passed it.
name
name: string;Defined in: node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.namemessage
message: string;Defined in: node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.messagestack?
optional stack?: string;Defined in: node_modules/.pnpm/typescript@5.8.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack