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

Change the default error on strict html failure to warn on dev and test #194

Closed
wants to merge 1 commit into from

Conversation

mcgoooo
Copy link
Contributor

@mcgoooo mcgoooo commented Apr 19, 2017

Previously you had fundamentally different behaviour on dev as your do
in production. It used to raise only on dev and test, and silently
fall through on production. The content items on live are not
always vaild in respect to multiple id's. This pull makes it warn
in the console, and have the bell sound so you can render pages,
while still keeping a reasonable warning in place.

I Think ideally we would raise a logging error on production too,
but we need to make sure the consequences of that would be ok,
this may be tackled in a further pull. Making sure that valid html is
coming through from govspeak, shuld ideally be tackled by the govspeak
gem/publisher at the source, so they can fix the errors when they create
them.

The code for doing the logging in slimmer seems to be a bit hokey
so i have overridden to use the default rails logger on dev and test
if it is there. For some reason, it passes in a nil logger,
and then also overrides that in this class, so i used a small hammer
as it would involve unwinding a lot of logging behaviour,
which i did try.

@mcgoooo mcgoooo changed the title Change the default error on strict failure to warn on dev and test Change the default error on strict html failure to warn on dev and test Apr 19, 2017
Previously you had fundamentally different behaviour on dev as your do
in production. It used to raise only on dev and test, and silently
fall through on production. The content items on live are not
always vaild in respect to multiple id's. This pull makes it warn
in the console, and have the bell sound so you can render pages,
while still keeping a reasonable warning in place.

I Think ideally we would raise a logging error on production too,
but we need to make sure the consequences of that would be ok,
this may be tackled in a further pull. Making sure that valid html is
coming through from govspeak, shuld ideally be tackled by the govspeak
gem/publisher at the source, so they can fix the errors when they create
them.

The code for doing the logging in slimmer seems to be a bit hokey
so i have overridden to use the default rails logger on dev and test
if it is there. For some reason, it passes in a nil logger,
and then also overrides that in this class, so i used a small hammer
as it would involve unwinding a lot of logging behaviour,
which i did try.
@mcgoooo mcgoooo force-pushed the Change-raise-to-warn-on-dev branch from b75eba2 to aef8897 Compare April 19, 2017 12:48
@mcgoooo
Copy link
Contributor Author

mcgoooo commented Apr 19, 2017

this is a screenshot of new dev output
screen shot 2017-04-19 at 13 54 20

@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency 'null_logger'
s.add_dependency 'rest-client'
s.add_dependency 'activesupport'
s.add_dependency 'colorize'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an unnecessary dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe, but it is good to have colored error messages, civil servants are users :D

# this all as it depends on all apps that use slimmer.
# This will make sure everything is logged correctly
# and put slimer renderings more in line with rendering
# normal templates
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this comment block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the logger is dependent on what you pass through from the Rails.application.config.slimmer in the consuming app of slimmer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seeing as none of the apps seem to pass it in, it is overridden in app.rb with null instance logger, so the options are either fix all the apps to get the error or use the small hammer of using the rails.logger if it is there

@mcgoooo mcgoooo closed this Apr 19, 2017
@mcgoooo mcgoooo reopened this Apr 19, 2017
@tijmenb tijmenb closed this Aug 14, 2017
@barrucadu barrucadu deleted the Change-raise-to-warn-on-dev branch September 10, 2018 12:44
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

Successfully merging this pull request may close these issues.

None yet

3 participants