Skip to content

Commit

Permalink
improve error handling (#291)
Browse files Browse the repository at this point in the history
* improve error handling

* Update .nycrc.json

* Update .nycrc.json

* Update package.json

Co-authored-by: Tomer Epstein <[email protected]>
  • Loading branch information
slavik-lvovsky and tomer-epstein authored Jun 2, 2020
1 parent 38035ef commit 4018ef2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
8 changes: 4 additions & 4 deletions backend/.nycrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"temp-dir": "./reports/.nyc_output",
"report-dir": "./reports/coverage",
"check-coverage": true,
"branches": 80.5,
"lines": 86.2,
"functions": 79.6,
"statements": 85.7
"branches": 79.8,
"lines": 86,
"functions": 81,
"statements": 86
}
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yeoman-ui",
"version": "1.0.10",
"version": "1.0.11",
"displayName": "Application Wizard",
"publisher": "SAPOS",
"author": {
Expand Down
19 changes: 7 additions & 12 deletions backend/src/yeomanui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,16 @@ export class YeomanUI {
this.promptCount = 0;
this.gen = (gen as Generator);
this.gen.destinationRoot(targetFolder);

env.addListener('error', (error: any) => {
this.onGeneratorFailure(generatorName, error);
});

this.gen.addListener('error', (error: any) => {
this.onGeneratorFailure(generatorName, error);
});

// we cannot use new async method, "await this.gen.run()", because generators based on older versions
// (for example: 2.0.5) of "yeoman-generator" do not support it
this.gen.run(async () => {
this.gen.run(async (error) => {
if (!this.errorThrown) {
const dirsAfter = await this.getChildDirectories(this.gen.destinationRoot());
this.onGeneratorSuccess(generatorName, dirsBefore, dirsAfter);
if (error) {
this.onGeneratorFailure(generatorName, error);
} else {
const dirsAfter = await this.getChildDirectories(this.gen.destinationRoot());
this.onGeneratorSuccess(generatorName, dirsBefore, dirsAfter);
}
}
});
} catch (error) {
Expand Down

0 comments on commit 4018ef2

Please sign in to comment.