Exception handling broken for customErrorTemplate when application relative path used


the docs state: (http://coldbox.ortusbooks.com/content/configuration/coldboxcfc/configuration_directives/coldbox.html)

customErrroTemplate: (yes, the docs do have this type-o)
The relative path from the application's root level of where the custom error template exists.

Therefore, for an application located at '/app', and a custom error at 'views/customError.cfm', the following configuration should work:

but it causes "Could not find the included template views/customError.cfm" at C:/inetpub/wwwroot/coldbox/system/Bootstrap.cfc: line 515

I believe this is because the processException function in Bootstrap.cfc is first checking if the custom error page exists with expandPath (which looks relative to the base executing page '/app/index.cfm', which is '/app/views/customError.cfm') and finds the file, but then includes the CF template with the include method (which looks relative to the current executing template '/coldbox/system/Bootstrap.cfc', and attempts to load '/coldbox/system/views/customError.cfm') and does not find the file.

ColdBox 3 would always prepend the appLocation before loading the custom error template and therefore worked because the path then became relative to the site root rather than a template which is consistent between expandPath and include used in components. ColdBox 4 only prepends the appLocation if it does not find the custom error template. Thus a workaround is to prepend the custom error template value with a '/', allowing the fileExists with expandPath to fail and the include call to succeed after the application path is prepended, however, this is not a valid path to the required file (as there is no 'views' directory at the site root) and is not relative to the application as the docs specify it should be. The default value works because it is relative to the site root.


Luis Majano
May 4, 2016, 1:14 AM

Thanks , this is fixed now.

Henry Ho
June 16, 2016, 10:36 PM

Weird, please check why Anonymous can change status of tickets.

Henry Ho
June 16, 2016, 10:37 PM

My comment is about they way we just include customError.cfm, which is quite dangerous as the cfm itself can introduce variables that would pollute the Boostrap's variables scope and may also introduce thread safe issues.



Luis Majano


Bryan Henderson




Fix versions