diff options
| author | jw255 | 2018-04-22 17:38:11 +0100 |
|---|---|---|
| committer | jw255 | 2018-04-22 17:38:11 +0100 |
| commit | c050e9e45ed64cfde0bb90f00cd4a4b13374a95f (patch) | |
| tree | 21ff8c16abdea42b05c89699065945328a2f75f6 /src | |
| parent | autocreating logs folder on startup (diff) | |
| download | medicine-c050e9e45ed64cfde0bb90f00cd4a4b13374a95f.tar.gz medicine-c050e9e45ed64cfde0bb90f00cd4a4b13374a95f.zip | |
fixing tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/FileRouter.ts | 4 | ||||
| -rw-r--r-- | src/serverConfig.ts | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/FileRouter.ts b/src/FileRouter.ts index ecd5185..7b19abd 100644 --- a/src/FileRouter.ts +++ b/src/FileRouter.ts @@ -171,7 +171,7 @@ const postProperties: Middleware = ( logger.debug('Editing server properties'); res.locals.modified = true; for (const newProp of req.body) { - const prop: Property | undefined = serverConfig.find( + let prop: Property | undefined = serverConfig.find( (p: Property): boolean => p.id === newProp.id ); if (prop === undefined) { @@ -183,6 +183,7 @@ const postProperties: Middleware = ( } try { prop.value = newProp.value; + } catch (err) { // FIXME: Assuming it's a value-type error, but it might not be! next(new RequestError(400, 'invalid_property_value', undefined, newProp.id)); @@ -968,6 +969,7 @@ export class FileRouter { name: projectName } }); + console.log("here") next(); } ); diff --git a/src/serverConfig.ts b/src/serverConfig.ts index 136995a..5d2575a 100644 --- a/src/serverConfig.ts +++ b/src/serverConfig.ts @@ -82,7 +82,7 @@ export class Property { } public set value(value: Value) { - if (!this.readOnly) { + if (this.readOnly) { throw new Error('this property is read-only'); } else if (!types[this.type](value)) { throw new Error(`value ${value} is not of type ${this.type}`); |
