List all render errors #189

Closed
risker opened this Issue Dec 7, 2016 · 2 comments

Projects

None yet

2 participants

@risker
risker commented Dec 7, 2016

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
Member
allmarkedup commented Dec 7, 2016 edited

@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
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