Попытка создать учетную запись и получать сообщения об ошибках - PullRequest
0 голосов
/ 23 мая 2019

Когда я запускаю мой код и пытаюсь зарегистрироваться, я получаю серию сообщений об ошибках:

(node:16084) UnhandledPromiseRejectionWarning: ValidationError: User validation failed: password: Path `password` is required.
    at new ValidationError (D:\JavaScript\TowerDefense\NewTowerDefense\TowerDefense-JS\node_modules\mongoose\lib\error\validation.js:30:11)
    at model.Document.invalidate (D:\JavaScript\TowerDefense\NewTowerDefense\TowerDefense-JS\node_modules\mongoose\lib\document.js:2259:32)
    at p.doValidate.skipSchemaValidators (D:\JavaScript\TowerDefense\NewTowerDefense\TowerDefense-JS\node_modules\mongoose\lib\document.js:2108:17)
    at D:\JavaScript\TowerDefense\NewTowerDefense\TowerDefense-JS\node_modules\mongoose\lib\schematype.js:981:9
    at process._tickCallback (internal/process/next_tick.js:61:11) (node:16084) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:16084) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. POST /users/authRegister -
- ms - -

Я понятия не имел, что я сделал неправильно, и снова, так как я не знал, какой файл вызывает проблему, я выкладываю весь репо здесь.

Редактировать

После двойной проверки строки подключения Mongo я теперь получаю это в дополнение к недавнему сообщению об ошибке:

(node:7964) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:7964) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:7964) UnhandledPromiseRejectionWarning: ReferenceError: error is not defined

    at User.findOne.then.user (D:\JavaScript\TowerDefense\NewTowerDefense\TowerDefense-JS\public\javascripts\userHandler.js:53:13)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:7964) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
...