Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V2] Error and Warning Handlers #4

Closed
bhough opened this issue Nov 3, 2016 · 9 comments
Closed

[V2] Error and Warning Handlers #4

bhough opened this issue Nov 3, 2016 · 9 comments
Assignees

Comments

@bhough
Copy link
Contributor

bhough commented Nov 3, 2016

Given that this is acting as a CSS compiler of sorts, each module should have error/warning handling that informs the user if they have provided the invalid values/syntax/etc... These should only be use in development and will be stripped out by webpack for production.

In my experiments I've been loosely following the formatting used in ELM. So they come out looking sort of like this:

-- Warning: Clear Fix -------------------------------------------------------- mixins/ClearFix.js--

  'clearFix' does not accept a parameter. However, you provided a parameter with a value of 50px.

  'clearFix' simply returns the cross-browser CSS necessary to clear floats and does not require
 any parameters to work.

--------------------------------------------------------------------------------------------------

Would love everyone's thoughts on this.

@mxstbr
Copy link
Member

mxstbr commented Nov 3, 2016

I like having very clear error messages, that could prove important. Let's see what we can do in our build system to strip those out in production but have them in dev!

@bhough bhough self-assigned this Nov 3, 2016
@ericclemmons
Copy link

Setting the bar for error messages would be a huge differentiator for this project.

@mxstbr mxstbr mentioned this issue Nov 4, 2016
50 tasks
@bhough bhough changed the title Error and Warning Handers Error and Warning Handlers Nov 7, 2016
@ericclemmons
Copy link

@bhough Is there a util that structures output like this already, or something we'd invent?

The last one I looked at was:

https://github.com/AriaMinaei/pretty-error

I believe we'd be able to throw an object that contained fields like message (typical Error property) and hint that could be leveraged for special output.

@mxstbr
Copy link
Member

mxstbr commented Nov 9, 2016

Reusing some common util would be great for this, or writing our own in a separate package!

@bhough
Copy link
Contributor Author

bhough commented Nov 9, 2016

I do like pretty-error's formatting. I'm starting on this issue next, so I will see if it will work with the verbose errors we want to display, if not I like the idea of creating our own @mxstbr.

One of the tricks I wanted to implement with this is to remove this error/warning functionality when the package is built for prod. I imagine that while useful for debugging during development, it would prove to be superfluous code for production. Does that assumption hold up with everyone?

@mxstbr
Copy link
Member

mxstbr commented Nov 9, 2016

Yeah that sounds very reasonable to me!

@bhough bhough mentioned this issue Dec 9, 2016
@bhough bhough mentioned this issue Dec 31, 2016
Merged
@bhough
Copy link
Contributor Author

bhough commented Mar 7, 2017

@mxstbr @nikgraf Question on this. As far as what errors we want to expose in dev/production. Right now I have formatted errors/warnings working in dev and completely disabled in prod (meaning no custom errors are thrown in prod at all). Are we fine with this, or do we want to draw a specific line between for what we leave in prod when it comes to custom errors.

@mxstbr
Copy link
Member

mxstbr commented Mar 7, 2017

That sounds reasonable to me @bhough! Do you have a WIP PR?

@nikgraf
Copy link
Member

nikgraf commented Mar 8, 2017

@bhough good question. It makes sense, but I'm not sure how we deal with inputs that don't make any sense e.g. rgb(66)?

@bhough bhough added this to the 2.0 milestone May 18, 2017
@bhough bhough changed the title Error and Warning Handlers [V2] Error and Warning Handlers May 18, 2017
@bhough bhough mentioned this issue May 18, 2017
14 tasks
@bhough bhough added the WIP label May 29, 2017
@bhough bhough closed this as completed Feb 4, 2018
@bhough bhough removed this from the 2.0 milestone Feb 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants