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

Add exception levels #24

Open
iGitScor opened this issue Mar 4, 2017 · 11 comments
Open

Add exception levels #24

iGitScor opened this issue Mar 4, 2017 · 11 comments

Comments

@iGitScor
Copy link
Owner

iGitScor commented Mar 4, 2017

Hi,

this plugin should have several exception levels

Exceptions

When an exception is caught, all the webpack build failed.
It should be nice if we could configure this behavior

Exception level

  • Strict: actual behavior. If the plugin fails, the webpack build crashes
  • None: no exception are caught and only a warning message is displayed in the console (if the silent mode is not activated)
  • Log: log errors in a log file (and also display a warning message like the none level)

Not forgive to add test

Thank you

@YQBird
Copy link
Contributor

YQBird commented Mar 10, 2017

Hi @iGitScor. I can take this work if no one else is currently working on it. I'll do some research first and discuss with you about the approach to do it. Thanks

@iGitScor
Copy link
Owner Author

Hi @YQBird,

Nobody has started working on it, so yes you can take this.
If you need help, please ask me 😉

Thank you

@YQBird
Copy link
Contributor

YQBird commented Mar 11, 2017

@iGitScor. My understanding here is that if plugin fails, the webpack build will still work in None & Log level. Only warning or log file is created. Is this correct?

@iGitScor
Copy link
Owner Author

Yes, that's correct. The main complexity will be to handle rights to write logs.

In the future we'll can potentially add clean log feature.

@YQBird
Copy link
Contributor

YQBird commented Mar 13, 2017

Hi @iGitScor. I'm thinking two approach here. The first one is to use process global object to catch the uncaught exception. When this event happens, a callback will be called to log or write log to file.
The second one is to integrate with winston npm module, depending on the exception level, different logger will be create. we can use some built-in function from this module and add log level.
Which one do you think is a better approach?

@iGitScor
Copy link
Owner Author

Hi,

I briefly read the documentation of Winston package and it seems to fit our need and the package is enough mature to be integrated. I am not 100% sure but I would choose for the second solution.
We'll see by the usage of it if it can be kept.

@YQBird
Copy link
Contributor

YQBird commented Mar 14, 2017

Hi. I personally prefer second approach as well. I'll start to work on that.

@YQBird
Copy link
Contributor

YQBird commented Mar 23, 2017

hi @iGitScor. Being really busy recently. I did some attempt to get exception level from constructor but find it's very difficult to get that argument and use it. I'm think to config exception level as a process.env variable, then use this variable in the core file. Any advice here ?

@iGitScor
Copy link
Owner Author

Hi,

I did some attempt to get exception level from constructor but find it's very difficult to get that argument and use it

do not hesitate to share gist to illustrate your difficulties.

I was thinking of this approach

@YQBird
Copy link
Contributor

YQBird commented Mar 26, 2017

Hi @iGitScor, here is what I have tried with this issue. https://github.com/YQBird/webpack-content-replacer-plugin/tree/add_exception_level. But I don't find a way to properly setting the log and do the testing yet. I am thinking if it is overkill to use winston for this issue. I will try to use NodeJS process object to solve this. Will keep you update.

@iGitScor
Copy link
Owner Author

iGitScor commented Mar 31, 2017

Hi @YQBird,

what do you mean ?

I don't find a way to properly setting the log

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

2 participants