introduced new exception classes for structured error reporting

This commit is contained in:
zadam
2022-12-09 16:04:13 +01:00
parent eaf195e0c8
commit 342ae6e5e2
27 changed files with 123 additions and 64 deletions

View File

@@ -6,6 +6,7 @@ const myScryptService = require('../services/my_scrypt');
const log = require('../services/log');
const passwordService = require("../services/password");
const assetPath = require("../services/asset_path");
const ValidationError = require("../public/app/services/validation_error.js");
function loginPage(req, res) {
res.render('login', {
@@ -23,7 +24,7 @@ function setPasswordPage(req, res) {
function setPassword(req, res) {
if (passwordService.isPasswordSet()) {
return [400, "Password has been already set"];
throw new ValidationError("Password has been already set");
}
let {password1, password2} = req.body;