Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to use .then({}).catch({}) block in all services while interacting with db #45

Open
varunon9 opened this issue Aug 24, 2018 · 1 comment
Labels
bug Something isn't working

Comments

@varunon9
Copy link
Member

We thought that if something will break at db level e.g. Error: Duplicate entry '1' for key 'PRIMARY' then it will be automatically caught by controller. But this is not happening. Server is crashing with no logs so need to use catch block in services as well.

@varunon9 varunon9 added the bug Something isn't working label Aug 24, 2018
@varunon9
Copy link
Member Author

An example-

createService: (service) => {
    return new Promise((resolve, reject) => {
      models.service.create(service).then(service => {
        resolve(service.dataValues);
      }).catch(err => {
        reject(err);
      });
    });
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant