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

Errors reading the session-data-default.js file get hidden #793

Closed
edwardhorsford opened this issue Aug 21, 2019 · 3 comments
Closed

Errors reading the session-data-default.js file get hidden #793

edwardhorsford opened this issue Aug 21, 2019 · 3 comments

Comments

@edwardhorsford
Copy link
Contributor

Several times I've been tripped up by having an mistake in my session-data-default.js that means it doesn't read, but not realising.

When the kit reads session-data-default.js it does throw an error if it can't read it - but this error is immediately hidden by some other lines. I tend to look to the end of my console to see if I have problems - since the error isn't there, I don't see it.

Example with an error:
Screenshot 2019-08-21 at 12 35 31

Since the kit keeps working - if you browse a few pages the original error message quickly scrolls out of view.

I wonder if we can do anything about this? stop the kit if there's an error rather than continuing?

@joelanman
Copy link
Contributor

Agree this might better to crash on. process.exit(1) might do it here:

console.error('Could not load the session data defaults from app/data/session-data-defaults.js. Might be a syntax error?')

Though I recall process.exit doesn't always work for us for some reason (for example if you say no to 'do you want a different port?')

@edwardhorsford
Copy link
Contributor Author

A followup to this - it would be really handy if the errors could be shown in the console output like normal js errors do. Even if you spot the above message, debugging what's gone wrong is really hard because no details are given - and you can't use console.log() to print anything to the console from this file.

@joelanman
Copy link
Contributor

you can try adding e to the log on this line

https://github.com/alphagov/govuk-prototype-kit/blob/master/lib/utils.js#L229

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

3 participants