Skip to content

Commit 3108ce3

Browse files
alan-agius4clydin
authored andcommitted
refactor: remove redundant error in catch
1 parent 7662b8d commit 3108ce3

13 files changed

Lines changed: 21 additions & 20 deletions

File tree

packages/angular/cli/commands/version.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default class VersionCommand extends Command {
9090
try {
9191
const gitRefName = '' + child_process.execSync('git symbolic-ref HEAD', {cwd: __dirname});
9292
gitBranch = path.basename(gitRefName.replace('\n', ''));
93-
} catch (e) {
93+
} catch {
9494
}
9595

9696
ngCliVersion = `local (v${pkg.version}, branch: ${gitBranch})`;
@@ -172,7 +172,7 @@ export default class VersionCommand extends Command {
172172

173173
return modulePkg.version + ' (cli-only)';
174174
}
175-
} catch (e) {
175+
} catch {
176176
}
177177

178178
return '<error>';

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export function getCommonConfig(wco: WebpackConfigOptions) {
203203
: 'rxjs/_esm5/path-mapping';
204204
const rxPaths = requireProjectModule(projectRoot, rxjsPathMappingImport);
205205
alias = rxPaths(nodeModules);
206-
} catch (e) { }
206+
} catch { }
207207

208208
const uglifyOptions = {
209209
ecma: wco.supportES2015 ? 6 : 5,

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function getServerConfig(wco: WebpackConfigOptions) {
5050
// It's a system thing (.ie util, fs...)
5151
callback();
5252
}
53-
} catch (e) {
53+
} catch {
5454
// Node couldn't find it, so it must be user-aliased
5555
callback();
5656
}

packages/angular_devkit/build_angular/src/protractor/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ export class ProtractorBuilder implements Builder<ProtractorBuilderOptions> {
106106
// When using npm, webdriver is within protractor/node_modules.
107107
webdriverUpdate = requireProjectModule(getSystemPath(projectRoot),
108108
`protractor/node_modules/${webdriverDeepImport}`);
109-
} catch (e) {
109+
} catch {
110110
try {
111111
// When using yarn, webdriver is found as a root module.
112112
webdriverUpdate = requireProjectModule(getSystemPath(projectRoot), webdriverDeepImport);
113-
} catch (e) {
113+
} catch {
114114
throw new Error(tags.stripIndents`
115115
Cannot automatically find webdriver-manager to update.
116116
Update webdriver-manager manually and run 'ng e2e --no-webdriver-update' instead.

packages/angular_devkit/build_angular/src/tslint/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ function getFileContents(
224224
// NOTE: The tslint CLI checks for and excludes MPEG transport streams; this does not.
225225
try {
226226
return stripBom(readFileSync(file, 'utf-8'));
227-
} catch (e) {
227+
} catch {
228228
throw new Error(`Could not read file '${file}'.`);
229229
}
230230
}

packages/angular_devkit/core/node/resolve.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export function resolve(x: string, options: ResolveOptions): string {
236236
return n;
237237
}
238238
}
239-
} catch (e) {}
239+
} catch {}
240240
}
241241

242242
return loadAsFileSync(path.join(x, '/index'));

packages/angular_devkit/core/src/virtual-fs/host/alias_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('AliasHost', () => {
2828
.subscribe(undefined, err => {
2929
expect(err.message).toMatch(/does not exist/);
3030
});
31-
} catch (e) {
31+
} catch {
3232
// Ignore it. RxJS <6 still throw errors when they happen synchronously.
3333
}
3434
});
@@ -49,7 +49,7 @@ describe('AliasHost', () => {
4949
try {
5050
aHost.read(normalize('/some/folder/file'))
5151
.subscribe(undefined, err => expect(err.message).toMatch(/does not exist/));
52-
} catch (e) {}
52+
} catch {}
5353

5454
// Create the file with new content and verify that this has the new content.
5555
aHost.write(normalize('/other/folder/file'), content2).subscribe();

packages/angular_devkit/core/src/virtual-fs/host/pattern_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('PatternMatchingHost', () => {
3232
.subscribe(undefined, err => {
3333
expect(err.message).toMatch(/does not exist/);
3434
});
35-
} catch (e) {
35+
} catch {
3636
// Ignore it. RxJS <6 still throw errors when they happen synchronously.
3737
}
3838

packages/angular_devkit/schematics/tasks/tslint-fix/executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function _getFileContent(
6262
// Strip BOM from file data.
6363
// https://stackoverflow.com/questions/24356713
6464
return fs.readFileSync(file, 'utf-8').replace(/^\uFEFF/, '');
65-
} catch (e) {
65+
} catch {
6666
throw new Error(`Could not read file '${file}'.`);
6767
}
6868
}

packages/ngtools/webpack/src/compiler_host.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export class WebpackCompilerHost implements ts.CompilerHost {
283283

284284
return stats;
285285
}
286-
} catch (e) {
286+
} catch {
287287
return undefined;
288288
}
289289
}
@@ -318,11 +318,11 @@ export class WebpackCompilerHost implements ts.CompilerHost {
318318
delegated = this._syncHost.list(p).filter((x: string) => {
319319
try {
320320
return this._syncHost.isFile(_join(p, x));
321-
} catch (e) {
321+
} catch {
322322
return false;
323323
}
324324
});
325-
} catch (e) {
325+
} catch {
326326
delegated = [];
327327
}
328328

@@ -340,11 +340,11 @@ export class WebpackCompilerHost implements ts.CompilerHost {
340340
delegated = this._syncHost.list(p).filter((x: string) => {
341341
try {
342342
return this._syncHost.isDirectory(_join(p, x));
343-
} catch (e) {
343+
} catch {
344344
return false;
345345
}
346346
});
347-
} catch (e) {
347+
} catch {
348348
delegated = [];
349349
}
350350

0 commit comments

Comments
 (0)