From fa96f0c38977a9cfc522f1446580e9888e8bdcd5 Mon Sep 17 00:00:00 2001 From: Vitaly Tomilov Date: Sat, 16 Jul 2016 01:32:06 +0100 Subject: [PATCH] Adding proper generic Not Implemented. (#2292) Proper way to generate common Promise rejects. --- .../Storage/Postgres/PostgresStorageAdapter.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js index 3c0373af2a..d5b8e85f29 100644 --- a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js +++ b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js @@ -104,11 +104,11 @@ export class PostgresStorageAdapter { }; classExists(name) { - return Promise.reject('Not implemented yet.') + return notImplemented(); } setClassLevelPermissions(className, CLPs) { - return Promise.reject('Not implemented yet.') + return notImplemented(); } createClass(className, schema) { @@ -172,7 +172,7 @@ export class PostgresStorageAdapter { // Drops a collection. Resolves with true if it was a Parse Schema (eg. _User, Custom, etc.) // and resolves with false if it wasn't (eg. a join table). Rejects if deletion was impossible. deleteClass(className) { - return Promise.reject('Not implemented yet.') + return notImplemented(); } // Delete all data known to this adapter. Used for testing. @@ -205,7 +205,7 @@ export class PostgresStorageAdapter { // Returns a Promise. deleteFields(className, schema, fieldNames) { - return Promise.reject('Not implemented yet.') + return notImplemented(); } // Return a promise for all schemas known to this adapter, in Parse format. In case the @@ -298,7 +298,7 @@ export class PostgresStorageAdapter { // Apply the update to all objects that match the given Parse Query. updateObjectsByQuery(className, schema, query, update) { - return Promise.reject('Not implemented yet.') + return notImplemented(); } // Return value not currently well specified. @@ -349,7 +349,7 @@ export class PostgresStorageAdapter { // Hopefully, we can get rid of this. It's only used for config and hooks. upsertOneObject(className, schema, query, update) { - return Promise.reject('Not implemented yet.') + return notImplemented(); } find(className, schema, query, { skip, limit, sort }) { @@ -427,5 +427,9 @@ export class PostgresStorageAdapter { } } +function notImplemented() { + return Promise.reject(new Error('Not implemented yet.')); +} + export default PostgresStorageAdapter; module.exports = PostgresStorageAdapter; // Required for tests