Skip to content

Commit

Permalink
fix: #6 don't iterate if don't find matching files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bajdzis committed Oct 5, 2019
1 parent 3481a68 commit 5206770
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export function activate(context: vscode.ExtensionContext) {
return fs.readFileSync(filePath).toString().split('\n');
});

if (contents.length < 2) {
return;
}

const [baseFile, ...otherFiles] = contents;
const lineToGenerate: string[] = [];

Expand Down Expand Up @@ -128,6 +132,10 @@ export function activate(context: vscode.ExtensionContext) {
const MAX_CHARACTERS_IN_URI: number = 4000;
let uri: string = `https://github.com/Bajdzis/vscode-awesome-tree/issues/new?title=${error.toString()}`;

if (error instanceof Error) {
uri = `https://github.com/Bajdzis/vscode-awesome-tree/issues/new?title=${error.toString()}&body=\`\`\`${error.stack}\`\`\``;
}

if (error instanceof AwesomeTreeError) {
uri = `https://github.com/Bajdzis/vscode-awesome-tree/issues/new?title=${error.getTitle()}&body=${error.getBody()}`;
}
Expand Down

0 comments on commit 5206770

Please sign in to comment.