Skip to content

Commit

Permalink
Revert "[typeorm] Catch JSON error in SIMPLE_JSON transformer"
Browse files Browse the repository at this point in the history
This reverts commit 1e78c6c.
  • Loading branch information
corneliusludmann committed Jul 13, 2021
1 parent 640d07a commit 2649821
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions components/gitpod-db/src/typeorm/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import { ValueTransformer } from "typeorm/decorator/options/ValueTransformer";
import { EncryptionService } from "@gitpod/gitpod-protocol/lib/encryption/encryption-service";
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";


export namespace Transformer {
Expand Down Expand Up @@ -46,12 +45,7 @@ export namespace Transformer {
return JSON.stringify(value || defaultValue);
},
from(value: any): any {
try {
return typeof value === 'object' ? value : JSON.parse(value);
} catch (e) {
log.error(`Cannot parse JSON during TypeORM transformation. Returning default value '${JSON.stringify(defaultValue)}' instead. Value: ${JSON.stringify(value)}`, e);
return defaultValue;
}
return JSON.parse(value);
}
};
}
Expand Down

0 comments on commit 2649821

Please sign in to comment.