Skip to content

Commit

Permalink
Adding proper generic Not Implemented. (parse-community#2292)
Browse files Browse the repository at this point in the history
Proper way to generate common Promise rejects.
  • Loading branch information
vitaly-t authored and Rafael Santos committed Mar 15, 2017
1 parent 65ea8c9 commit 82f03cd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Adapters/Storage/Postgres/PostgresStorageAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 }) {
Expand Down Expand Up @@ -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

0 comments on commit 82f03cd

Please sign in to comment.