Skip to content

Commit 27bce31

Browse files
committed
Remove try/catch
1 parent 7a9f514 commit 27bce31

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

lib/JsonSchemaModule.js

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,34 +35,31 @@ class JsonSchemaModule extends AbstractModule {
3535

3636
await this._library.init()
3737

38-
try {
39-
this._library.addKeyword({
40-
keyword: 'isDirectory',
41-
type: 'string',
42-
modifying: true,
43-
schemaType: 'boolean',
44-
compile: function () {
45-
const doReplace = value => {
46-
const app = App.instance
47-
return [
48-
['$ROOT', app.rootDir],
49-
['$DATA', app.getConfig('dataDir')],
50-
['$TEMP', app.getConfig('tempDir')]
51-
].reduce((m, [k, v]) => {
52-
return m.startsWith(k) ? path.resolve(v, m.replace(k, '').slice(1)) : m
53-
}, value)
54-
}
55-
return (value, { parentData, parentDataProperty }) => {
56-
try {
57-
parentData[parentDataProperty] = doReplace(value)
58-
} catch (e) {}
59-
return true
60-
}
38+
this._library.addKeyword({
39+
keyword: 'isDirectory',
40+
type: 'string',
41+
modifying: true,
42+
schemaType: 'boolean',
43+
compile: function () {
44+
const doReplace = value => {
45+
const app = App.instance
46+
return [
47+
['$ROOT', app.rootDir],
48+
['$DATA', app.getConfig('dataDir')],
49+
['$TEMP', app.getConfig('tempDir')]
50+
].reduce((m, [k, v]) => {
51+
return m.startsWith(k) ? path.resolve(v, m.replace(k, '').slice(1)) : m
52+
}, value)
6153
}
62-
})
63-
} catch (e) {
64-
console.log(e);
65-
}
54+
return (value, { parentData, parentDataProperty }) => {
55+
try {
56+
parentData[parentDataProperty] = doReplace(value)
57+
} catch (e) {}
58+
return true
59+
}
60+
}
61+
})
62+
6663
this.onReady()
6764
.then(() => this.app.waitForModule('config', 'errors'))
6865
.then(() => {

0 commit comments

Comments
 (0)