Note: This is based on top of #71. Please first look at #71, so hopefully #71 can be merged and then there will be fewer changes here. Then you can take a look at this one.
Second note: If this is merged and released, there should be a major version bump (I'd say 4.5) with a changelog entry, because it is a possible backwards incompatible change if somebody has:
manually set validation level to soft (e.g. is not using the default config) and
relies on MJML-Rails raising an error on any template error, which it wouldn't do then anymore
Before this commit MJML-Rails always raised an exception if there is any
template validation error.
In MJML there are two validation levels though (besides disabling
validation completely):
strict: Raise an error if there are any problems, abort
soft: Do your best and compile what you can, but do not raise any
error. Output errors on stderr.
Right now it does not matter what validation level is used in
MJML-Rails: It always raises an error if something is wrong with the
template, which actually makes the setting MJML.validation_level
superfluous.
With this commit, MJML-Rails follows the MJML convention to only abort
if the validation level is strict. If it is soft, it lets MJML do
what it can and only logs the errors, like MJML does.
To prevent apps using the default configuration from breaking, the
default validation level is changed to strict, too. This means it
raises an error on an invalid template like it did before.
Note: This is based on top of #71. Please first look at #71, so hopefully #71 can be merged and then there will be fewer changes here. Then you can take a look at this one.
Second note: If this is merged and released, there should be a major version bump (I'd say
4.5
) with a changelog entry, because it is a possible backwards incompatible change if somebody has:soft
(e.g. is not using the default config) andBefore this commit MJML-Rails always raised an exception if there is any template validation error.
In MJML there are two validation levels though (besides disabling validation completely):
strict
: Raise an error if there are any problems, abortsoft
: Do your best and compile what you can, but do not raise any error. Output errors on stderr.Right now it does not matter what validation level is used in MJML-Rails: It always raises an error if something is wrong with the template, which actually makes the setting
MJML.validation_level
superfluous.With this commit, MJML-Rails follows the MJML convention to only abort if the validation level is
strict
. If it issoft
, it lets MJML do what it can and only logs the errors, like MJML does.To prevent apps using the default configuration from breaking, the default validation level is changed to
strict
, too. This means it raises an error on an invalid template like it did before.