5htp-core 0.6.0-81 → 0.6.0-82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,8 +56,8 @@ export type ServerBug = {
56
56
 
57
57
  // Error
58
58
  title?: string,
59
- errors: TCatchedError[],
60
- logs: TJsonLog[],
59
+ stacktraces: string[],
60
+ context: object[],
61
61
  }
62
62
 
63
63
  export type TCatchedError = Error | CoreError | Anomaly;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.6.0-81",
4
+ "version": "0.6.0-82",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -310,16 +310,26 @@ export default class Console {
310
310
 
311
311
  // On envoi l'email avant l'insertion dans bla bdd
312
312
  // Car cette denrière a plus de chances de provoquer une erreur
313
- const logs = this.logs.filter(e => e.channel.channelId === channelId).slice(-100);
313
+ //const logs = this.logs.filter(e => e.channel.channelId === channelId).slice(-100);
314
+ const stacktraces: string[] = [];
315
+ const context: object[] = [];
314
316
 
315
- const errors: TCatchedError[] = []
316
317
  let currentError: TCatchedError | undefined = error;
317
318
  let title: string | undefined;
318
319
  while (currentError !== undefined) {
319
320
 
321
+ if (title === undefined)
322
+ title = currentError.message;
323
+
324
+ // Stacktrace
320
325
  this.logger.error(LogPrefix, `Sending bug report for the following error:`, currentError);
321
- if (('dataForDebugging' in currentError) && currentError.dataForDebugging !== undefined)
326
+ stacktraces.push(currentError.stack || currentError.message);
327
+
328
+ // Context
329
+ if (('dataForDebugging' in currentError) && currentError.dataForDebugging !== undefined) {
322
330
  console.error(LogPrefix, `More data about the error:`, currentError.dataForDebugging);
331
+ context.push(currentError.dataForDebugging || {});
332
+ }
323
333
 
324
334
  // Print the error so it's accessible via logs
325
335
  if (currentError instanceof SqlError) {
@@ -332,10 +342,7 @@ export default class Console {
332
342
  console.error(`Error caused by this query:`, printedQuery);
333
343
  }
334
344
 
335
- if (title === undefined)
336
- title = currentError.message;
337
-
338
- errors.push(currentError);
345
+ // Go deeper
339
346
  currentError = 'originalError' in currentError
340
347
  ? currentError.originalError
341
348
  : undefined
@@ -369,8 +376,8 @@ export default class Console {
369
376
 
370
377
  // Error
371
378
  title,
372
- errors,
373
- logs
379
+ stacktraces,
380
+ context
374
381
  }
375
382
 
376
383
  await application.runHook('bug', bugReport);
@@ -394,14 +401,15 @@ export default class Console {
394
401
  <b>User</b>: ${report.user ? (report.user.name + ' (' + report.user.email + ')') : 'Unknown'}<br />
395
402
  <b>IP</b>: ${report.ip}<br />
396
403
 
397
- ${report.errors.map(e => `
404
+ ${report.stacktraces.map((stacktrace, index) => `
405
+ <hr />
406
+ <b>Error ${index + 1}</b>:
407
+ ${this.printHtml(stacktrace)}<br />
408
+ `).join('')}
409
+
410
+ ${report.context.map((context, index) => `
398
411
  <hr />
399
- <b>Error</b>: ${e.message}<br />
400
- ${this.printHtml(e.stack || e.message)}<br />
401
- ${'dataForDebugging' in e ? `
402
- <b>Data for debugging</b><br />
403
- ${this.jsonToHTML(e.dataForDebugging)}<br />
404
- ` : ''}
412
+ <b>Context ${index + 1}</b>: ${this.jsonToHTML(context)}<br />
405
413
  `).join('')}
406
414
 
407
415
  ${report.request ? `
package/types/icons.d.ts CHANGED
@@ -1 +1 @@
1
- export type TIcones = "long-arrow-right"|"times"|"solid/spinner-third"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"chart-bar"|"crosshairs"|"arrow-right"|"user-circle"|"plus-circle"|"comments-alt"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"at"|"calendar-alt"|"paper-plane"|"user-plus"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"key"|"user"|"magnet"|"plus"|"binoculars"|"brands/linkedin"|"clock"|"cog"|"trash"|"ellipsis-h"|"times-circle"|"search"|"lightbulb"|"solid/crown"|"brands/discord"|"pen"|"file"|"envelope"|"angle-up"|"angle-down"|"coins"|"angle-right"|"download"|"info-circle"|"check-circle"|"exclamation-circle"|"check"|"meh-rolling-eyes"|"arrow-left"|"users"|"bug"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"power-off"|"bars"|"question-circle"|"plane-departure"|"brands/whatsapp"|"wind"|"play"|"minus-circle"|"external-link"|"broom"|"exclamation-triangle"|"solid/check-circle"|"solid/exclamation-triangle"|"solid/times-circle"|"minus"|"comment-alt"|"arrow-to-bottom"|"map-marker-alt"|"solid/magic"|"briefcase"|"map-marker"|"fire"|"industry"|"calendar"|"magic"|"globe"|"building"|"graduation-cap"|"coin"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"unlink"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"
1
+ export type TIcones = "times"|"solid/spinner-third"|"long-arrow-right"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"chart-bar"|"user-circle"|"crosshairs"|"plus-circle"|"comments-alt"|"arrow-right"|"link"|"key"|"user"|"at"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"file-alt"|"long-arrow-left"|"user-plus"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"calendar-alt"|"paper-plane"|"brands/linkedin"|"search"|"lightbulb"|"magnet"|"angle-up"|"angle-down"|"solid/crown"|"brands/discord"|"pen"|"plus"|"file"|"envelope"|"clock"|"cog"|"trash"|"ellipsis-h"|"binoculars"|"coins"|"times-circle"|"download"|"info-circle"|"check-circle"|"exclamation-circle"|"check"|"meh-rolling-eyes"|"arrow-left"|"bars"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"power-off"|"play"|"minus-circle"|"external-link"|"question-circle"|"plane-departure"|"brands/whatsapp"|"wind"|"map-marker-alt"|"arrow-to-bottom"|"users"|"bug"|"broom"|"solid/check-circle"|"solid/exclamation-triangle"|"solid/times-circle"|"minus"|"solid/magic"|"exclamation-triangle"|"industry"|"map-marker"|"calendar"|"briefcase"|"fire"|"magic"|"globe"|"comment-alt"|"coin"|"building"|"graduation-cap"|"unlink"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"