How to use the http-status.FAILED_DEPENDENCY function in http-status

To help you get started, we’ve selected a few http-status examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WaftTech / WaftEngine / server / modules / module / moduleController.js View on Github external
//TODO: check value is from option or not
          return otherHelper.sendResponse(res, HttpStatus.FAILED_DEPENDENCY, false, null, `key 'default' is not found or valid string for label '${v.label}'`);
        }
        break;
      case 'DateTime':
        if (v.default) {
        } else {
          //TODO: check value is from option or not
          return otherHelper.sendResponse(res, HttpStatus.FAILED_DEPENDENCY, false, null, `key 'default' is not found or valid string for label '${v.label}'`);
        }
        break;
      case 'Decimal':
        if ('' + v.default && !isNaN(parseFloat(v.default))) {
          v.default = parseFloat(v.default);
        } else {
          return otherHelper.sendResponse(res, HttpStatus.FAILED_DEPENDENCY, false, null, `key 'default' is not found or valid value for label '${v.label}'`);
        }
        if ('' + v.maxDigit && !isNaN(parseInt(v.maxDigit)) && parseInt(v.maxDigit) <= 16) {
          v.maxDigit = parseInt(v.maxDigit);
        } else {
          return otherHelper.sendResponse(res, HttpStatus.FAILED_DEPENDENCY, false, null, `key 'maxDigit' is not found or valid value or less than 17 for label '${v.label}'`);
        }
        if ('' + v.decimalPlace && !isNaN(parseInt(v.decimalPlace)) && parseInt(v.decimalPlace) <= 9) {
          v.decimalPlace = parseInt(v.decimalPlace);
        } else {
          return otherHelper.sendResponse(res, HttpStatus.FAILED_DEPENDENCY, false, null, `key 'decimalPlace' is not found or valid value or less than 10 for label '${v.label}'`);
        }
        break;
      case 'LongInteger':
        break;
      case 'Checkbox':
        break;
github WaftTech / WaftEngine / server / modules / module / moduleController.js View on Github external
return otherHelper.sendResponse(res, httpStatus.FAILED_DEPENDENCY, false, null, `Section must have layout selected`);
  } else if (!moduleConfig.section.layout.includes(v.layout)) {
    return otherHelper.sendResponse(res, httpStatus.FAILED_DEPENDENCY, false, null, `Section must have valid layout selected`);
  }
  if (v.fields && v.fields.length) {
    v.fields.forEach((elem, index) => {
      for (let [k1, v1] of Object.entries(elem)) {
        if (v1.type === 'Section') {
          internal.checkSection(res, k1, v1);
        } else {
          internal.checkField(res, k1, v1);
        }
      }
    });
  } else {
    return otherHelper.sendResponse(res, httpStatus.FAILED_DEPENDENCY, false, null, 'Section must have at least one field');
  }
};
moduleController.GetFieldConfig = async (req, res, next) => {