( code: WorkspaceErrorCode, message: string, path?: string, )
| 20 | } |
| 21 | |
| 22 | export function createWorkspaceError( |
| 23 | code: WorkspaceErrorCode, |
| 24 | message: string, |
| 25 | path?: string, |
| 26 | ): WorkspaceFsError { |
| 27 | const error = new Error(path === undefined ? message : `${message}: ${path}`) as WorkspaceFsError; |
| 28 | error.name = "WorkspaceFsError"; |
| 29 | error.code = code; |
| 30 | error.path = path; |
| 31 | return error; |
| 32 | } |
| 33 | |
| 34 | export function invalidPath(path: string, reason: string): WorkspaceFsError { |
| 35 | return createWorkspaceError("EINVAL", `Invalid path (${reason})`, path); |
no outgoing calls