How to use the verror.VError.cause function in verror

To help you get started, we’ve selected a few verror 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 openkfw / TruBudget / api / src / http_errors.ts View on Github external
function selectHighLevelCause(error: Error): string {
  if (error.name !== "Error" && error.name !== "VError") {
    return error.name;
  }
  const cause = VError.cause(error);
  if (cause === null) {
    return error.name;
  } else {
    return selectHighLevelCause(cause);
  }
}