Skip to content
This repository has been archived by the owner on Jul 24, 2022. It is now read-only.

Error codes should be configurable #6

Open
russormes opened this issue Feb 28, 2018 · 0 comments
Open

Error codes should be configurable #6

russormes opened this issue Feb 28, 2018 · 0 comments

Comments

@russormes
Copy link
Contributor

What

Error codes are very particular to your service. Also, one of the uses of the codes are to obscure information about the errors, so having them public is not always desirable.

Proposal

error.setCodes = function setCodes(codeDict) {
    error.codes = codeDict;
};
error.addCodes = function addCodes(codeDict) {
    error.codes = Object.assign({}, error.codes, codeDict);
};

We expose two functions that allow for error codes to be replaced or extended.

Further to this we could introduce a configuration object to the ayEs lib that allows for you to pass in a custom error codes definition file.

const config = {
   loadErrorCodesFrom: '/path/to/errorCode.js'
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant