This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79e1cb3
commit 8a21957
Showing
53 changed files
with
498 additions
and
8,880 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,3 +134,5 @@ assets/stylesheets/styles.css | |
|
||
# vscode | ||
.vscode/* | ||
|
||
package_lock.json |
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,158 +1,27 @@ | ||
const errorRes = (code) => { | ||
if (isNaN(code)) throw new Error('Invalid error code provided') | ||
switch (code) { | ||
case 1: | ||
return { | ||
httpCode: 401, | ||
code: 1, | ||
message: 'No API key provided', | ||
} | ||
case 2: | ||
return { | ||
httpCode: 401, | ||
code: 2, | ||
message: 'Invalid API key provided', | ||
} | ||
case 3: | ||
return { | ||
httpCode: 403, | ||
code: 3, | ||
message: 'The provided API key has been disabled', | ||
} | ||
case 4: | ||
return { | ||
httpCode: 400, | ||
code: 4, | ||
message: 'Missing Query Paramater(s)' | ||
} | ||
case 5: | ||
return { | ||
httpCode: 400, | ||
code: 5, | ||
message: 'Invalid Query Paramater(s)' | ||
} | ||
case 6: | ||
return { | ||
httpCode: 400, | ||
code: 6, | ||
message: 'Missing Header Paramater(s)' | ||
} | ||
case 7: | ||
return { | ||
httpCode: 400, | ||
code: 7, | ||
message: 'Invalid Header Paramater(s)' | ||
} | ||
case 8: | ||
return { | ||
httpCode: 400, | ||
code: 8, | ||
message: 'Missing Body Paramater(s)' | ||
} | ||
case 9: | ||
return { | ||
httpCode: 400, | ||
code: 9, | ||
message: 'Invalid Body Paramater(s)' | ||
} | ||
case 10: | ||
return { | ||
httpCode: 400, | ||
code: 10, | ||
message: 'Unable to encrypt data' | ||
} | ||
case 11: | ||
return { | ||
httpCode: 400, | ||
code: 11, | ||
message: 'Unable to decrypt data' | ||
} | ||
case 12: | ||
return { | ||
httpCode: 403, | ||
code: 12, | ||
message: 'You are not authorized to access this resource' | ||
} | ||
case 13: | ||
return { | ||
httpCode: 404, | ||
code: 13, | ||
message: 'Unable to find requested resource' | ||
} | ||
case 14: | ||
return { | ||
httpCode: 500, | ||
code: 14, | ||
message: 'Unable to delete requested user' | ||
} | ||
case 15: | ||
return { | ||
httpCode: 500, | ||
code: 15, | ||
message: 'Unable to delete requested token' | ||
} | ||
case 16: | ||
return { | ||
httpCode: 403, | ||
code: 16, | ||
message: 'The request was denied due to being blacklisted', | ||
} | ||
case 17: | ||
return { | ||
httpCode: 423, | ||
code: 17, | ||
message: 'This endpoint is currently disabled', | ||
} | ||
case 18: | ||
return { | ||
httpCode: 403, | ||
code: 18, | ||
message: 'The license associated with the provided API key has expired', | ||
} | ||
case 19: | ||
return { | ||
httpCode: 403, | ||
code: 19, | ||
message: 'The license associated with the provided API key has been disabled', | ||
} | ||
case 20: | ||
return { | ||
httpCode: 403, | ||
code: 20, | ||
message: 'The license associated with the provided API key has been revoked', | ||
} | ||
case 21: | ||
return { | ||
httpCode: 501, | ||
code: 21, | ||
message: 'This endpoint has not been implemented yet', | ||
} | ||
case 22: | ||
return { | ||
httpCode: 500, | ||
code: 22, | ||
message: 'Unable to create requested user', | ||
} | ||
case 23: | ||
return { | ||
httpCode: 500, | ||
code: 23, | ||
message: 'Unable to update requested user', | ||
} | ||
case 24: | ||
return { | ||
httpCode: 500, | ||
code: 24, | ||
message: 'Unable to create requested user', | ||
} | ||
case 25: | ||
default: | ||
return { | ||
httpCode: 500, | ||
code: 0, | ||
message: 'Unknown error', | ||
} | ||
} | ||
} | ||
|
||
module.exports = errorRes; | ||
module.exports = new Map() | ||
.set(0, { httpCode: 500, code: 0, message: 'Unknown error' }) | ||
.set(1, { httpCode: 401, code: 1, message: 'No API key provided', }) | ||
.set(2, { httpCode: 401, code: 2, message: 'Invalid API key provided', }) | ||
.set(3, { httpCode: 403, code: 3, message: 'The provided API key has been disabled', }) | ||
.set(4, { httpCode: 400, code: 4, message: 'Missing Query Paramater(s)' }) | ||
.set(5, { httpCode: 400, code: 5, message: 'Invalid Query Paramater(s)' }) | ||
.set(6, { httpCode: 400, code: 6, message: 'Missing Header Paramater(s)' }) | ||
.set(7, { httpCode: 400, code: 7, message: 'Invalid Header Paramater(s)' }) | ||
.set(8, { httpCode: 400, code: 8, message: 'Missing Body Paramater(s)' }) | ||
.set(9, { httpCode: 400, code: 9, message: 'Invalid Body Paramater(s)' }) | ||
.set(10, { httpCode: 400, code: 10, message: 'Unable to encrypt data' }) | ||
.set(11, { httpCode: 400, code: 11, message: 'Unable to decrypt data' }) | ||
.set(12, { httpCode: 403, code: 12, message: 'You are not authorized to access this resource' }) | ||
.set(13, { httpCode: 404, code: 13, message: 'Unable to find requested resource' }) | ||
.set(14, { httpCode: 500, code: 14, message: 'Unable to delete requested user' }) | ||
.set(15, { httpCode: 500, code: 15, message: 'Unable to delete requested token' }) | ||
.set(16, { httpCode: 403, code: 16, message: 'The request was denied due to being blacklisted', }) | ||
.set(17, { httpCode: 423, code: 17, message: 'This endpoint is currently disabled', }) | ||
.set(18, { httpCode: 403, code: 18, message: 'The license associated with the provided API key has expired', }) | ||
.set(19, { httpCode: 403, code: 19, message: 'The license associated with the provided API key has been disabled', }) | ||
.set(20, { httpCode: 403, code: 20, message: 'The license associated with the provided API key has been revoked', }) | ||
.set(21, { httpCode: 501, code: 21, message: 'This endpoint has not been implemented yet', }) | ||
.set(22, { httpCode: 500, code: 22, message: 'Unable to create requested user', }) | ||
.set(23, { httpCode: 500, code: 23, message: 'Unable to update requested user', }) | ||
.set(24, { httpCode: 500, code: 24, message: 'Unable to create requested user', }) | ||
.get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
aprilFools: () => new Date().getMonth() === 3 && new Date().getDate() === 1 | ||
aprilFools: _ => new Date().getMonth() === 3 && new Date().getDate() === 1 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.