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 20, 2020
1 parent 12b663e commit eeb944d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 63 deletions.
38 changes: 2 additions & 36 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,3 @@
<!--
Hey there 👋 Please have a look at our guidelines on reporting issues:
https://github.com/SAP/ui5-tooling/blob/master/CONTRIBUTING.md#-reporting-issues
-->
## 🚨 Issues Have Been Transferred to UI5 Tooling Repository

## Expected Behavior
{...}

## Current Behavior
{...}

## Steps to reproduce the issue
1. {...}
2. {...}
3. {...}

## Context
- UI5 Module Version *(output of `ui5 --version` when using the CLI)*: `{...}`
- Node.js Version: `{...}`
- npm Version: `{...}`
- OS/Platform: `{...}`
- Browser *(if relevant)*: `{...}`
- Other information: `{...}`

## Affected components *(if known)*
<!-- Check affected components by writing an "X" into the brackets -->
- [ ] [ui5-builder](https://github.com/SAP/ui5-builder)
- [ ] [ui5-server](https://github.com/SAP/ui5-server)
- [X] [ui5-cli](https://github.com/SAP/ui5-cli)
- [ ] [ui5-fs](https://github.com/SAP/ui5-fs)
- [ ] [ui5-project](https://github.com/SAP/ui5-project)
- [ ] [ui5-logger](https://github.com/SAP/ui5-logger)

## Log Output / Stack Trace
```
{...}
```
Please create new issues in the UI5 Tooling repository: https://github.com/SAP/ui5-tooling/issues/new/choose
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Report UI5 Tooling Issues or Request a Feature
url: https://github.com/SAP/ui5-tooling/issues/new/choose
about: Please create new issues in the UI5 Tooling repository
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
2 changes: 1 addition & 1 deletion test/lib/cli/commands/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test("Exception error handling with verbose logging", async (t) => {

t.deepEqual(stdoutLines[stdoutLines.length - 1],
"If you think this is an issue of the UI5 Tooling, you might " +
"report it using the following URL: https://github.com/SAP/ui5-cli/issues/new",
"report it using the following URL: https://github.com/SAP/ui5-tooling/issues/new/choose",
"Correct last log line");

t.deepEqual(err.exitCode, 1, "Process was exited with code 1");
Expand Down

0 comments on commit eeb944d

Please sign in to comment.