Skip to content

Commit ff9bfb4

Browse files
committed
Merge branch 'refs/heads/feat-report-error' into feat-cli-sudo
2 parents 6ce7b0a + 11de1cc commit ff9bfb4

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

templates/cli/index.js.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ program
3838
.on("option:verbose", () => {
3939
cliConfig.verbose = true;
4040
})
41-
.on("option:report", () => {
41+
.on("option:report", function() {
4242
cliConfig.report = true;
4343
cliConfig.reportData = { data: this };
4444
})

templates/cli/lib/parser.js.twig

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,25 @@ const parseError = (err) => {
129129
} catch {
130130
}
131131

132-
const version = '0.16.0';
133-
const stepsToReproduce = encodeURIComponent(`Running \`appwrite ${cliConfig.reportData.data.args}\``);
134-
const yourEnvironment = encodeURI(`CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`)
132+
const version = '{{ sdk.version }}';
133+
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args}\``;
134+
const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`;
135135

136-
const stack = encodeURIComponent('```\n' + err.stack + '\n```').replaceAll('(', '').replaceAll(')', '');
136+
const stack = '```\n' + err.stack + '\n```';
137137

138-
const githubIssueUrl = `https://github.com/appwrite/appwrite/issues/new?labels=bug&template=bug.yaml&title=%F0%9F%90%9B+Bug+Report%3A+CLI+error:+${encodeURI(err.message)}&actual-behavior=CLI%20Error:%0A${stack}&steps-to-reproduce=${stepsToReproduce}&environment=${yourEnvironment}`;
138+
const githubIssueUrl = new URL('https://github.com/appwrite/appwrite/issues/new');
139+
githubIssueUrl.searchParams.append('labels', 'bug');
140+
githubIssueUrl.searchParams.append('template', 'bug.yaml');
141+
githubIssueUrl.searchParams.append('title', `🐛 Bug Report: ${err.message}`);
142+
githubIssueUrl.searchParams.append('actual-behavior', `CLI Error:\n${stack}`);
143+
githubIssueUrl.searchParams.append('steps-to-reproduce', stepsToReproduce);
144+
githubIssueUrl.searchParams.append('environment', yourEnvironment);
139145

140-
log(`To report this error you can:\n - Create a support ticket in our Discord server https://appwrite.io/discord \n - Create an issue in our Github\n ${githubIssueUrl}\n`);
146+
log(`To report this error you can:\n - Create a support ticket in our Discord server https://appwrite.io/discord \n - Create an issue in our Github\n ${githubIssueUrl.href}\n`);
141147

142148
process.exit(1);
143149
})()
144-
}
145-
else {
150+
} else {
146151
if (cliConfig.verbose) {
147152
console.error(err);
148153
} else {

0 commit comments

Comments
 (0)