Skip to content

Didn't work with async function's try catch #26

@ablipan

Description

@ablipan
(async function() {
      try {
        // update Store
        if (paramStore.id) {
          const finded = await Store.findOne(paramStore.id);
          _.assign(finded, paramStore);
          finded.save();
        }else {
          // add Store
          await Store.create(paramStore);
        }
        return res.ok();
      } catch (err) {
        sails.log.error(err);
        sails.log.error(err.Errors);
        return res.serverError(err);
      }
    })();

the err.Errors is undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions