diff options
author | ab <abdullah_ahmed@brown.edu> | 2019-07-14 23:39:56 -0400 |
---|---|---|
committer | ab <abdullah_ahmed@brown.edu> | 2019-07-14 23:39:56 -0400 |
commit | b7dd805549c5cdb6b583312e5e9637f9f3e0ee93 (patch) | |
tree | 24217f91f213e57c503d226bae1475acb84c6a1d /src/client/util/SerializationHelper.ts | |
parent | baf446a5d65f8e0203eb3c7fb2f43d62a6997daa (diff) | |
parent | d7c6f0da00d4ed56d28f679d6f7de1002684864a (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/util/SerializationHelper.ts')
-rw-r--r-- | src/client/util/SerializationHelper.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/util/SerializationHelper.ts b/src/client/util/SerializationHelper.ts index a7246d7c4..dca539f3b 100644 --- a/src/client/util/SerializationHelper.ts +++ b/src/client/util/SerializationHelper.ts @@ -1,5 +1,6 @@ import { PropSchema, serialize, deserialize, custom, setDefaultModelSchema, getDefaultModelSchema, primitive, SKIP } from "serializr"; import { Field } from "../../new_fields/Doc"; +import { ClientUtils } from "./ClientUtils"; export namespace SerializationHelper { let serializing: number = 0; @@ -9,7 +10,7 @@ export namespace SerializationHelper { export function Serialize(obj: Field): any { if (obj === undefined || obj === null) { - return undefined; + return null; } if (typeof obj !== 'object') { @@ -38,7 +39,12 @@ export namespace SerializationHelper { serializing += 1; if (!obj.__type) { - throw Error("No property 'type' found in JSON."); + if (ClientUtils.RELEASE) { + console.warn("No property 'type' found in JSON."); + return undefined; + } else { + throw Error("No property 'type' found in JSON."); + } } if (!(obj.__type in serializationTypes)) { |