Skip to content

Commit

Permalink
refactor(Manager): add error message string
Browse files Browse the repository at this point in the history
  • Loading branch information
1Computer1 committed Jul 3, 2021
1 parent 6bda9bc commit 1b00547
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/errors/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ const Messages = {
INTERACTION_NOT_REPLIED: 'This interaction has not been deferred or replied to.',
INTERACTION_EPHEMERAL_REPLIED: 'Ephemeral responses cannot be fetched or deleted.',
INTERACTION_FETCH_EPHEMERAL: 'Ephemeral responses cannot be fetched.',

NOT_IMPLEMENTED: (what, name) => `Method ${what} not implemented on ${name}.`,
};

for (const [name, message] of Object.entries(Messages)) register(name, message);
3 changes: 2 additions & 1 deletion src/managers/DataManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const BaseManager = require('./BaseManager');
const { Error } = require('../errors');

let Structures;

Expand Down Expand Up @@ -31,7 +32,7 @@ class DataManager extends BaseManager {
* @abstract
*/
get cache() {
throw new Error(`Getter 'cache' not implemented for ${this.constructor.name}`);
throw new Error('NOT_IMPLEMENTED', 'get cache', this.constructor.name);
}

/**
Expand Down

0 comments on commit 1b00547

Please sign in to comment.