UNPKG

1.05 kBTypeScriptView Raw
1import { GitError } from './git-error';
2/**
3 * The `GitResponseError` is the wrapper for a parsed response that is treated as
4 * a fatal error, for example attempting a `merge` can leave the repo in a corrupted
5 * state when there are conflicts so the task will reject rather than resolve.
6 *
7 * For example, catching the merge conflict exception:
8 *
9 * ```typescript
10 import { gitP, SimpleGit, GitResponseError, MergeSummary } from 'simple-git';
11
12 const git = gitP(repoRoot);
13 const mergeOptions: string[] = ['--no-ff', 'other-branch'];
14 const mergeSummary: MergeSummary = await git.merge(mergeOptions)
15 .catch((e: GitResponseError<MergeSummary>) => e.git);
16
17 if (mergeSummary.failed) {
18 // deal with the error
19 }
20 ```
21 */
22export declare class GitResponseError<T = any> extends GitError {
23 /**
24 * `.git` access the parsed response that is treated as being an error
25 */
26 readonly git: T;
27 constructor(
28 /**
29 * `.git` access the parsed response that is treated as being an error
30 */
31 git: T, message?: string);
32}