UNPKG

1.2 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.GitResponseError = void 0;
4const 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 */
25class 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}
35exports.GitResponseError = GitResponseError;
36//# sourceMappingURL=git-response-error.js.map
\No newline at end of file