Skip to content

Commit

Permalink
[INTERNAL] Error handling: Recommend ui5-tooling repository for creat…
Browse files Browse the repository at this point in the history
…ing issue

Related to SAP/ui5-tooling#273
  • Loading branch information
RandomByte committed Nov 19, 2020
1 parent 12b663e commit 00270bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/bl

Please follow our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/master/CONTRIBUTING.md#report-an-issue) on how to report an issue.

Please report issues in the main [UI5 Tooling](https://github.com/SAP/ui5-tooling) repository.

## Release History

See [CHANGELOG.md](CHANGELOG.md).
32 changes: 6 additions & 26 deletions lib/cli/commands/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,12 @@ cli.usage("Usage: ui5 <command> [options]")
console.log("");
console.log(chalk.underline("Stack Trace:"));
console.log(err.stack);

// Try to guess responsible module from stack trace file paths
// This should work for the following paths:
// - @ui5/cli (npm consumption)
// - ui5-cli (local repository consumption)
// - lib/cli (local consumption without repository name in path, i.e. Azure CI)
const moduleRegExp = /@?(?:ui5|lib).(?:logger|fs|builder|server|project|cli)/ig;

// Only check the lowest stack entry
const rootStackEntry = err.stack.split("\n")[1];
const match = rootStackEntry.match(moduleRegExp);
if (match) {
// Use the last match of the line because of cases like this:
// node_modules/@ui5/cli/node_modules/@ui5/builder/lib/ => should match the builder
let moduleNameGuess = match[match.length - 1];

// Normalize match
moduleNameGuess = moduleNameGuess.replace(/.*(?:ui5|lib).(.*)/i, "ui5-$1").toLowerCase();
const newIssueUrl = `https://github.com/SAP/${moduleNameGuess}/issues/new`;
console.log("");
console.log(
chalk.dim(
`If you think this is an issue of the UI5 Tooling, you might report it using the ` +
`following URL: `) +
chalk.dim.bold.underline(newIssueUrl));
}
console.log("");
console.log(
chalk.dim(
`If you think this is an issue of the UI5 Tooling, you might report it using the ` +
`following URL:`) +
chalk.dim.bold.underline(`https://github.com/SAP/ui5-tooling/issues/new/choose`));
} else {
console.log("");
console.log(chalk.dim(
Expand Down

0 comments on commit 00270bb

Please sign in to comment.