Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions i18n/arabic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ const cli = {
http_server_started: "تم تشغيل خادم HTTP على:",
missingEnv: tS`متغير البيئة ${0} مفقود!`,
stat: tS`${0} ${1} في ${2}`,
error: {
name: tS`اسم ${0}: ${1}`,
message: tS`الرسالة: ${0}`,
phase: tS`حدث الخطأ أثناء مرحلة ${0}`,
statusCode: tS`رمز حالة HTTP: ${0}`,
executionTime: tS`حدث الخطأ في ${0} أثناء التنفيذ`,
stack: tS`المكدس: ${0}`
},
commands: {
option_depth: "أقصى عمق للتبعيات لجلبه",
option_output: "اسم ملف JSON الناتج",
Expand Down
8 changes: 8 additions & 0 deletions i18n/english.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ const cli = {
http_server_started: "HTTP Server started on:",
missingEnv: tS`Environment variable ${0} is missing!`,
stat: tS`${0} ${1} in ${2}`,
error: {
name: tS`${0} name: ${1}`,
message: tS`Message: ${0}`,
phase: tS`The error occured during the ${0} phase`,
statusCode: tS`HTTP Status Code: ${0}`,
executionTime: tS`The error occured at ${0} during the execution`,
stack: tS`Stack: ${0}`
},
commands: {
option_depth: "Maximum dependencies depth to fetch",
option_output: "Json file output name",
Expand Down
8 changes: 8 additions & 0 deletions i18n/french.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ const cli = {
http_server_started: "Serveur HTTP démarré sur :",
missingEnv: tS`La variable d'environnement ${0} est manquante!`,
stat: tS`${0} ${1} en ${2}`,
error: {
name: tS`Nom ${0}: ${1}`,
message: tS`Message: ${0}`,
phase: tS`L'erreur s'est produite pendant la phase ${0}`,
statusCode: tS`Code statut HTTP: ${0}`,
executionTime: tS`L'erreur s'est produite à ${0} pendant l'exécution`,
stack: tS`Stack: ${0}`
},
commands: {
option_depth: "Niveau de profondeur de dépendances maximum à aller chercher",
option_output: "Nom de sortie du fichier json",
Expand Down
8 changes: 8 additions & 0 deletions i18n/turkish.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ const cli = {
http_server_started: "HTTP Sunucusu başlatıldı:",
missingEnv: tS`${0} ortam değişkeni eksik!`,
stat: tS`${0} ${1} içinde ${2}`,
error: {
name: tS`${0} adı: ${1}`,
message: tS`Mesaj: ${0}`,
phase: tS`Hata ${0} aşamasında meydana geldi`,
statusCode: tS`HTTP Durum Kodu: ${0}`,
executionTime: tS`Hata yürütme sırasında ${0} tarihinde meydana geldi`,
stack: tS`Yığın: ${0}`
},
commands: {
option_depth: "Getirilecek maksimum bağımlılık derinliği",
option_output: "JSON dosyası çıktı adı",
Expand Down
40 changes: 40 additions & 0 deletions src/commands/scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,46 @@ function initLogger(spec, verbose = true) {
startSpinners();
});

logger.on("error", (error, phase) => {
stopSpinners();

console.log(kleur.bold.white(
i18n.getTokenSync("cli.error.name",
kleur.red().bold("error"),
error.name
)));

if (error.message) {
console.log(i18n.getTokenSync("cli.error.message",
error.message
));
}

if (phase) {
console.log(i18n.getTokenSync("cli.error.phase",
phase
));
}

if (error.statusCode) {
console.log(i18n.getTokenSync("cli.error.statusCode",
error.statusCode
));
}

console.log(i18n.getTokenSync("cli.error.executionTime",
kleur.cyan().bold(formatMs(error.executionTime))
));

if (error.stack) {
console.log(i18n.getTokenSync("cli.error.stack",
error.stack
));
}

startSpinners();
});

return logger;
}

Expand Down