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

List all render errors #189

Closed
mihkeleidast opened this issue Dec 7, 2016 · 2 comments
Closed

List all render errors #189

mihkeleidast opened this issue Dec 7, 2016 · 2 comments

Comments

@mihkeleidast
Copy link
Member

Is there a way to list all errors (partial not found) that fractal encounters while rendering components?

Right now the only way (that I'm aware of) to know that all components rendered correctly is to manually go through every page and make sure there are no errors.

@allmarkedup
Copy link
Member

allmarkedup commented Dec 7, 2016

@Risker - there is nothing right now (although I've got a few things planned - see #84), but you could put together a CLI task to do this using something like this:

fractal.cli.command('check-errors', function(opts, done){
    process.on('unhandledRejection', () => {}); // workaround for poor error catching in the views!
    fractal.load().then(src => {
        for (let comp of fractal.components.flatten()) {
            comp.render().then(html => {
                this.console.success(`@${comp.handle}`);
            }).catch(err => {
                this.console.error(`@${comp.handle} - ${err.message} (${comp.viewPath})`);
            });
        }
    });
    done();
});

It basically just runs through all the components, tries to render them and then outputs whether the process was successful or not. Would that help?

@allmarkedup
Copy link
Member

Forgot to add that you would put the above into your fractal.js file, and then could run it from the CLI using the command fractal check-errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants