simple-git
Version:
Simple GIT interface for node.js
36 lines (34 loc) • 1.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* The `GitError` is thrown when the underlying `git` process throws a
* fatal exception (eg an `ENOENT` exception when attempting to use a
* non-writable directory as the root for your repo), and acts as the
* base class for more specific errors thrown by the parsing of the
* git response or errors in the configuration of the task about to
* be run.
*
* When an exception is thrown, pending tasks in the same instance will
* not be executed. The recommended way to run a series of tasks that
* can independently fail without needing to prevent future tasks from
* running is to catch them individually:
*
* ```typescript
import { gitP, SimpleGit, GitError, PullResult } from 'simple-git';
function catchTask (e: GitError) {
return e.
}
const git = gitP(repoWorkingDir);
const pulled: PullResult | GitError = await git.pull().catch(catchTask);
const pushed: string | GitError = await git.pushTags().catch(catchTask);
```
*/
class GitError extends Error {
constructor(task, message) {
super(message);
this.task = task;
Object.setPrototypeOf(this, new.target.prototype);
}
}
exports.GitError = GitError;
//# sourceMappingURL=git-error.js.map