UNPKG

1.17 kBTypeScriptView Raw
1import type { SimpleGitTask } from '../types';
2/**
3 * The `GitError` is thrown when the underlying `git` process throws a
4 * fatal exception (eg an `ENOENT` exception when attempting to use a
5 * non-writable directory as the root for your repo), and acts as the
6 * base class for more specific errors thrown by the parsing of the
7 * git response or errors in the configuration of the task about to
8 * be run.
9 *
10 * When an exception is thrown, pending tasks in the same instance will
11 * not be executed. The recommended way to run a series of tasks that
12 * can independently fail without needing to prevent future tasks from
13 * running is to catch them individually:
14 *
15 * ```typescript
16 import { gitP, SimpleGit, GitError, PullResult } from 'simple-git';
17
18 function catchTask (e: GitError) {
19 return e.
20 }
21
22 const git = gitP(repoWorkingDir);
23 const pulled: PullResult | GitError = await git.pull().catch(catchTask);
24 const pushed: string | GitError = await git.pushTags().catch(catchTask);
25 ```
26 */
27export declare class GitError extends Error {
28 task?: SimpleGitTask<any> | undefined;
29 constructor(task?: SimpleGitTask<any> | undefined, message?: string);
30}