Added tokeCommand delete endpoint and ajax call, replaced all raw error responses.

This commit is contained in:
rainbow napkin 2024-12-12 05:11:47 -05:00
parent af7f4219a5
commit 864304f13b
28 changed files with 93 additions and 64 deletions

View file

@ -15,14 +15,13 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
//At some point this will be a bit more advanced, right now it's just a placeholder :P
module.exports.errorHandler = function(res, msg, type = "Generic"){
res.status(400);
module.exports.errorHandler = function(res, msg, type = "Generic", status = 400){
res.status(status);
return res.send({errors: [{type, msg, date: new Date()}]});
}
module.exports.exceptionHandler = function(res, err){
//if not yell at the browser for fucking up, and tell it what it did wrong.
res.status(400);
module.exports.errorHandler(res, err.message, "Caught Exception");
}