Skip to content

Commit

Permalink
Merge pull request #37 from AthennaIO/develop
Browse files Browse the repository at this point in the history
fix(exception): apply colors in pretty exception
  • Loading branch information
jlenon7 authored Mar 21, 2023
2 parents 22d77fe + 8123d69 commit 69fff04
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/common",
"version": "3.4.2",
"version": "3.4.3",
"description": "The Athenna common helpers to use in any Node.js ESM project.",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down
6 changes: 4 additions & 2 deletions src/Helpers/Exception.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ export class Exception extends Error {
const helpKey = Color.gray.bold.bgGreen(' HELP ')
const title = Color.gray.bold.bgRed(` ${this.code || this.name} `)

this.message = `${title}\n\n${this.message}`
this.message = `${title}\n\n${Color.apply(this.message)}`

if (this.help && this.help !== '') {
this.help = `${helpKey}\n\n ${Color.green(this.help)}\n\n ${separator}`
this.help = `${helpKey}\n\n ${Color.green(
Color.apply(this.help),
)}\n\n ${separator}`
} else {
this.message = this.message.concat(`\n\n${separator}`)
}
Expand Down

0 comments on commit 69fff04

Please sign in to comment.