feat: show error stack on unknown error (#124)

* feat: show error stack on unknown error

* improve message
This commit is contained in:
hiroki osame
2023-03-03 00:58:22 -05:00
committed by GitHub
parent 915a4ada60
commit 5fe127d377
8 changed files with 45 additions and 14 deletions

View File

@@ -1,10 +1,11 @@
import { execa } from 'execa';
import { KnownError } from './error.js';
export const assertGitRepo = async () => {
const { stdout } = await execa('git', ['rev-parse', '--is-inside-work-tree'], { reject: false });
if (stdout !== 'true') {
throw new Error('The current directory must be a Git repository!');
throw new KnownError('The current directory must be a Git repository!');
}
};