NIHVIVO-3118 Send an email to the site administrator in case of an error on a Freemarker page if the user is not authorized to view the error details.

This commit is contained in:
ryounes 2011-08-12 00:03:39 +00:00
parent 6bb9831bda
commit 044c4a0674
4 changed files with 131 additions and 30 deletions

View file

@ -4,20 +4,22 @@
<p>
There was an error in the system.
<#-- This error has been reported to the site administrator. -->
<#if sentEmail>
This error has been reported to the site administrator.
</#if>
</p>
<#if errorData??> <#-- view for site administrators -->
<#if errorData.errorMessage?has_content>
<p><strong>Error message:</strong> ${errorData.errorMessage}</p>
<#if adminErrorData??> <#-- view for site administrators -->
<#if adminErrorData.errorMessage?has_content>
<p><strong>Error message:</strong> ${adminErrorData.errorMessage}</p>
</#if>
<#if errorData.stackTrace?has_content>
<#if adminErrorData.stackTrace?has_content>
<div>
<p><strong>Stack trace</strong> (full trace available in the vivo log):</p>
${errorData.stackTrace}
${adminErrorData.stackTrace}
</div>
</#if>
<#elseif ! urls.currentPage?ends_with("home")> <#-- view for other users -->
<#elseif ! errorOnHomePage> <#-- view for other users -->
<p>Return to the <a href="${urls.home}">home page</a>.</p>
</#if>

View file

@ -0,0 +1,49 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for email message sent to site administrator when an error occurs on the site. -->
<#assign subject = "An error occurred on the VIVO site" />
<#assign datetime = datetime?string("yyyy-MM-dd HH:mm:ss zzz")>
<#assign html>
<html>
<head>
<title>${subject}</title>
</head>
<body>
<p>
An error occurred on your VIVO site at ${datetime}.
</p>
<p>
<strong>Requested url:</strong> ${requestedUrl}.
</p>
<p>
<strong>Error message:</strong> ${errorMessage}.
</p>
<p>
<strong>Stack trace</strong> (full trace available in the vivo log):
</p>
<div>${stackTrace}</div>
</body>
</html>
</#assign>
<#assign text>
An error occurred on your VIVO site at ${datetime}.
Requested url: ${requestedUrl}.
Error message: ${errorMessage}.
Stack trace (full trace available in the vivo log):
${stackTrace}
</#assign>
<@email subject=subject html=html text=text />