Skip to content

Commit 1f02883

Browse files
committed
catch writeFile error
1 parent 4e96eb9 commit 1f02883

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

lib/modules/editor/actions/writeFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function writeFileFromFile(_a) {
2626
console.log(err, readErr);
2727
}
2828
fs_1.writeFile(toAbs, data, function (writeErr) {
29-
if (err, writeErr) {
29+
if (writeErr) {
3030
console.log(writeErr);
3131
}
3232
console.log("wrote file contents of " + to + " to " + from);

src/modules/editor/actions/writeFile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function writeFileFromFile({to, from, dir, tutorialDir}) {
2424
const err = `Error: tried to write '${fromAbs}' to '${toAbs}' but failed.`;
2525
if (readErr) { console.log(err, readErr); }
2626
writeFile(toAbs, data, (writeErr) => {
27-
if (err, writeErr) { console.log(writeErr); }
27+
if (writeErr) { console.log(writeErr); }
2828
console.log(`wrote file contents of ${to} to ${from}`);
2929
});
3030
});
@@ -38,9 +38,9 @@ function createFolders({dir, to}) {
3838
if (folders.length === 0) {
3939
resolve();
4040
} else {
41-
let current = [];
41+
let current: string[] = [];
4242
// write each missing folder
43-
folders.forEach(x => {
43+
folders.forEach((x: string) => {
4444
current.push(x);
4545
const folderPath = join(dir, current.join('/'));
4646
if (!fileExists(folderPath)) {

src/modules/tutorial/utils/config-repo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function configRepo(repo?: { url: string }): string {
1+
export function configRepo(repo?: { url: string }): string|null {
22
if (repo && repo.url) {
33
let url: string = repo.url;
44
if (!!url.match(/\.git$/)) {
@@ -9,6 +9,6 @@ export function configRepo(repo?: { url: string }): string {
99
return null;
1010
}
1111

12-
export function configIssuesPath(bugs?: { url: string }): string {
12+
export function configIssuesPath(bugs?: { url: string }): string|null {
1313
return bugs && bugs.url ? bugs.url : null;
1414
}

src/modules/tutorial/utils/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export function tutorialConfig(
1010
): Tutorial.Config {
1111
// package.json: name, config
1212
const {config, name} = tutorialPj;
13-
const repo: string = configRepo(tutorialPj.repo);
13+
const repo = configRepo(tutorialPj.repo);
1414
const tutorialDir: string = join(dir, 'node_modules', name, config.dir);
1515
const runner: string = config.runner;
1616
const runnerOptions: Object = config.runnerOptions || {};
17-
const configEdit: boolean = tutorialPj.config.edit;
17+
const configEdit = tutorialPj.config.edit;
1818

1919
const getRunner = configRunner(name, config.runner, dir);
2020

0 commit comments

Comments
 (0)