reuse errors.JS and hash.JS
from https://codeberg.org/buzzcode2007/FCC-Project-URLShortener/src/branch/main/scripts/utilities
This commit is contained in:
parent
0902ec9cb2
commit
f966e0564e
2 changed files with 63 additions and 0 deletions
25
scripts/utilities/errors.JS
Normal file
25
scripts/utilities/errors.JS
Normal file
|
@ -0,0 +1,25 @@
|
|||
class CustomErrors {}
|
||||
|
||||
CustomErrors.URL = class URL_Error extends Error {
|
||||
constructor(message, URL) {
|
||||
super((message) ? message : `invalid url`);
|
||||
this.name = "URL Problem";
|
||||
this.stack = URL;
|
||||
};
|
||||
}
|
||||
|
||||
CustomErrors.DBProblem = class DB_Error extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = "Database Problem"
|
||||
}
|
||||
}
|
||||
|
||||
CustomErrors.HashProblem = class DB_Error extends Error {
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = "Hash Problem"
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CustomErrors
|
Loading…
Add table
Add a link
Reference in a new issue