Adding proper generic Not Implemented. (#2292)

Proper way to generate common Promise rejects.
This commit is contained in:
Vitaly Tomilov
2016-07-16 01:32:06 +01:00
committed by Florent Vilmart
parent d07dd4c49f
commit fa96f0c389

View File

@@ -104,11 +104,11 @@ export class PostgresStorageAdapter {
}; };
classExists(name) { classExists(name) {
return Promise.reject('Not implemented yet.') return notImplemented();
} }
setClassLevelPermissions(className, CLPs) { setClassLevelPermissions(className, CLPs) {
return Promise.reject('Not implemented yet.') return notImplemented();
} }
createClass(className, schema) { 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.) // 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. // and resolves with false if it wasn't (eg. a join table). Rejects if deletion was impossible.
deleteClass(className) { deleteClass(className) {
return Promise.reject('Not implemented yet.') return notImplemented();
} }
// Delete all data known to this adapter. Used for testing. // Delete all data known to this adapter. Used for testing.
@@ -205,7 +205,7 @@ export class PostgresStorageAdapter {
// Returns a Promise. // Returns a Promise.
deleteFields(className, schema, fieldNames) { 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 // 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. // Apply the update to all objects that match the given Parse Query.
updateObjectsByQuery(className, schema, query, update) { updateObjectsByQuery(className, schema, query, update) {
return Promise.reject('Not implemented yet.') return notImplemented();
} }
// Return value not currently well specified. // 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. // Hopefully, we can get rid of this. It's only used for config and hooks.
upsertOneObject(className, schema, query, update) { upsertOneObject(className, schema, query, update) {
return Promise.reject('Not implemented yet.') return notImplemented();
} }
find(className, schema, query, { skip, limit, sort }) { 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; export default PostgresStorageAdapter;
module.exports = PostgresStorageAdapter; // Required for tests module.exports = PostgresStorageAdapter; // Required for tests