Skip to content

Commit fa96f0c

Browse files
vitaly-tflovilmart
authored andcommitted
Adding proper generic Not Implemented. (#2292)
Proper way to generate common Promise rejects.
1 parent d07dd4c commit fa96f0c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ export class PostgresStorageAdapter {
104104
};
105105

106106
classExists(name) {
107-
return Promise.reject('Not implemented yet.')
107+
return notImplemented();
108108
}
109109

110110
setClassLevelPermissions(className, CLPs) {
111-
return Promise.reject('Not implemented yet.')
111+
return notImplemented();
112112
}
113113

114114
createClass(className, schema) {
@@ -172,7 +172,7 @@ export class PostgresStorageAdapter {
172172
// Drops a collection. Resolves with true if it was a Parse Schema (eg. _User, Custom, etc.)
173173
// and resolves with false if it wasn't (eg. a join table). Rejects if deletion was impossible.
174174
deleteClass(className) {
175-
return Promise.reject('Not implemented yet.')
175+
return notImplemented();
176176
}
177177

178178
// Delete all data known to this adapter. Used for testing.
@@ -205,7 +205,7 @@ export class PostgresStorageAdapter {
205205

206206
// Returns a Promise.
207207
deleteFields(className, schema, fieldNames) {
208-
return Promise.reject('Not implemented yet.')
208+
return notImplemented();
209209
}
210210

211211
// Return a promise for all schemas known to this adapter, in Parse format. In case the
@@ -298,7 +298,7 @@ export class PostgresStorageAdapter {
298298

299299
// Apply the update to all objects that match the given Parse Query.
300300
updateObjectsByQuery(className, schema, query, update) {
301-
return Promise.reject('Not implemented yet.')
301+
return notImplemented();
302302
}
303303

304304
// Return value not currently well specified.
@@ -349,7 +349,7 @@ export class PostgresStorageAdapter {
349349

350350
// Hopefully, we can get rid of this. It's only used for config and hooks.
351351
upsertOneObject(className, schema, query, update) {
352-
return Promise.reject('Not implemented yet.')
352+
return notImplemented();
353353
}
354354

355355
find(className, schema, query, { skip, limit, sort }) {
@@ -427,5 +427,9 @@ export class PostgresStorageAdapter {
427427
}
428428
}
429429

430+
function notImplemented() {
431+
return Promise.reject(new Error('Not implemented yet.'));
432+
}
433+
430434
export default PostgresStorageAdapter;
431435
module.exports = PostgresStorageAdapter; // Required for tests

0 commit comments

Comments
 (0)