Skip to content

Commit

Permalink
chore(logs): use CssSyntaxError showSourceCode method (#1957)
Browse files Browse the repository at this point in the history
  • Loading branch information
astahmer authored Jan 7, 2024
1 parent 3f6b366 commit 14033e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-geese-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@pandacss/core': patch
---

Display better CssSyntaxError logs
10 changes: 2 additions & 8 deletions packages/core/src/stylesheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class Stylesheet {
layer.append(toCss(styles).toString())
} catch (error) {
if (error instanceof CssSyntaxError) {
logger.error('sheet:process', error)
logger.error('sheet:process', error.showSourceCode(true))
}
}
return
Expand Down Expand Up @@ -91,13 +91,7 @@ export class Stylesheet {
return optimize ? optimizeCss(css, { minify }) : css
} catch (error) {
if (error instanceof CssSyntaxError) {
logger.error('sheet:toCss', error.message)
error.plugin && logger.error('sheet:toCss', `By plugin: ${error.plugin}:`)

if (error.source) {
logger.error('sheet:toCss', `Line ${error.line}:${error.column}, in:`)
logger.error('sheet:toCss', error.source)
}
logger.error('sheet:toCss', error.showSourceCode(true))
}

throw error
Expand Down

3 comments on commit 14033e0

@vercel
Copy link

@vercel vercel bot commented on 14033e0 Jan 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

panda-docs – ./website

panda-docs.vercel.app
panda-docs-git-main-chakra-ui.vercel.app
panda-docs-chakra-ui.vercel.app
panda-css.com

@vercel
Copy link

@vercel vercel bot commented on 14033e0 Jan 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

panda-studio – ./

panda-app.vercel.app
panda-studio-chakra-ui.vercel.app
panda-studio-git-main-chakra-ui.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 14033e0 Jan 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.