1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.GitResponseError = void 0;
|
4 | const git_error_1 = require("./git-error");
|
5 | /**
|
6 | * The `GitResponseError` is the wrapper for a parsed response that is treated as
|
7 | * a fatal error, for example attempting a `merge` can leave the repo in a corrupted
|
8 | * state when there are conflicts so the task will reject rather than resolve.
|
9 | *
|
10 | * For example, catching the merge conflict exception:
|
11 | *
|
12 | * ```typescript
|
13 | import { gitP, SimpleGit, GitResponseError, MergeSummary } from 'simple-git';
|
14 |
|
15 | const git = gitP(repoRoot);
|
16 | const mergeOptions: string[] = ['--no-ff', 'other-branch'];
|
17 | const mergeSummary: MergeSummary = await git.merge(mergeOptions)
|
18 | .catch((e: GitResponseError<MergeSummary>) => e.git);
|
19 |
|
20 | if (mergeSummary.failed) {
|
21 | // deal with the error
|
22 | }
|
23 | ```
|
24 | */
|
25 | class GitResponseError extends git_error_1.GitError {
|
26 | constructor(
|
27 | /**
|
28 | * `.git` access the parsed response that is treated as being an error
|
29 | */
|
30 | git, message) {
|
31 | super(undefined, message || String(git));
|
32 | this.git = git;
|
33 | }
|
34 | }
|
35 | exports.GitResponseError = GitResponseError;
|
36 | //# sourceMappingURL=git-response-error.js.map |
\ | No newline at end of file |