Send better errors and set proper filename
Showing
1 changed file
with
5 additions
and
2 deletions
... | @@ -17,12 +17,15 @@ along with this software (see the LICENSE.md file). If not, see | ... | @@ -17,12 +17,15 @@ along with this software (see the LICENSE.md file). If not, see |
17 | 17 | ||
18 | <actions> | 18 | <actions> |
19 | <entity-find-one entity-name="moqui.basic.email.EmailTemplate" value-field="emailTemplate" auto-field-map="[emailTemplateId:emailTemplateId]"/> | 19 | <entity-find-one entity-name="moqui.basic.email.EmailTemplate" value-field="emailTemplate" auto-field-map="[emailTemplateId:emailTemplateId]"/> |
20 | <if condition="!emailTemplate || !emailTemplate.htmlLocation"> | 20 | <if condition="!emailTemplate || !emailTemplate.htmlLocation || !emailTemplate.htmlPublishedVersionName"> |
21 | <return error="true" message="Email Template not found"/> | 21 | <return error="true" message="Email Template not found"/> |
22 | </if> | 22 | </if> |
23 | <set field="dataPre" from="ec.resource.getLocationReference(emailTemplate.htmlLocation).getText(emailTemplate.htmlPublishedVersionName)"/> | 23 | <set field="dataPre" from="ec.resource.getLocationReference(emailTemplate.htmlLocation).getText(emailTemplate.htmlPublishedVersionName)"/> |
24 | <if condition="dataPre == null"> | ||
25 | <return error="true" message="Email Template does not exist at ${emailTemplate.htmlLocation} with version ${emailTemplate.htmlPublishedVersionName}"/> | ||
26 | </if> | ||
24 | <script><![CDATA[ | 27 | <script><![CDATA[ |
25 | String location = "template.ftl"; | 28 | String location = emailTemplate?.htmlLocation ?: "template.ftl"; |
26 | 29 | ||
27 | freemarker.template.Template newTemplate; | 30 | freemarker.template.Template newTemplate; |
28 | Reader templateReader = null; | 31 | Reader templateReader = null; | ... | ... |
-
Please register or sign in to post a comment