Обещание не может быть выполнено с undefined, если statusCode не 204. - PullRequest
0 голосов
/ 27 мая 2020

В моей функциональности есть два шага: 1. Я пытаюсь сохранить данные о сотрудниках, используя концепцию сущности. 2. После сохранения я вызываю хранимую процедуру, в которую я передаю вывод из вывода saveemployee шага 1.

Ниже моя функция

    saveMultipleEmployee = async (uploadedData, connect) => {
        try {
          var getConn = await Connection.get().getConnectionDB(connect)
          const multipleEmployeeRepository = getConn.getRepository(MultipleEmployee);
          const multipleEmployeeResult = await multipleEmployeeRepository.save(uploadedData);
          var arrayToString = JSON.stringify(multipleEmployeeResult);
            let customPositionResultAfterInsert = await entityManager.query(`exec [dfed].[save_multiple_employee_data]`);
            console.log('customPositionResultAfterInsert',customPositionResultAfterInsert)
         return true
        }
        catch (err) {
          return err;
        }

Я получаю следующие ошибки в консоли

     {"level":50,"time":1590553808199,"pid":31444,"hostname":"DE-DACAPPSWV745","reqId":18,"err":{"type":"FastifyError","message":"FST_ERR_PROMISE_NOT_FULLFILLED: Promise may not be fulfilled with 'undefined' when statusCode is not 204","stack":"FastifyError [FST_ERR_PROMISE_NOT_FULLFILLED]: FST_ERR_PROMISE_NOT_FULLFILLED: Promise may not be fulfilled with 'undefined' when statusCode is not 204\n    at E:\\Rajitha\\queenbackend\\dfed\\node_modules\\fastify\\lib\\wrapThenable.js:34:30\n    at processTicksAndRejections (internal/process/task_queues.js:93:5)","name":"FastifyError [FST_ERR_PROMISE_NOT_FULLFILLED]","code":"FST_ERR_PROMISE_NOT_FULLFILLED","statusCode":500},"msg":"Promise may not be fulfilled with 'undefined' when statusCode is not 204","v":1}
...