Coldbox 6-RC: Whoops template

Still testing CB-6 and trying out the new Whoops error template. When enabled, each test error I throw seems to get thrown/repeated 4 times? At first I thought it might be a conflict with my bug tracking module, but disabling that and just doing a simple writelog from the main.onException handler logs the same error 4 times… even though Lucee shows only a single exception being caught.

We would need a way to replicate this

Luis Majano
CEO
Ortus Solutions, Corp

P/F: 1-888-557-8057

OK, so after troubleshooting this, it has something to do with the way the whoops template is using javascript.

We load our javascript at the bottom of our layouts just above the closing body tag. However we have a module that stores the script paths and names in the app storage of the cbStorages module. On a fwreinit, the module uses an afterConfigurationLoad interceptor to check if any of the CSS or JS files had been modified and if so, adds a cache-buster to the filename. So bottom of one of our layouts looks like this:

`

`

Which then translates into something like this:

`

`

It’s just a simple key/value lookup, nothing more.

If I just plug the actual, translated paths/filenames into the layout, then everything works fine. If I keep the AssetRegister module in play, whoops causes every error in a view to happen multiple times.

Here’s the relevant code from the actual ModuleConfig.cfc should it matter…

`

function configure(){
settings = {
assets = {
“css”:
{
“main” : “/assets/css/style.css”,
“bs3” : “/assets/css/bs3/bootstrap.min.css”,
“dt_bs3” : “/assets/js/libs/dt_bs3/datatables.min.css”,
“bs4” : “/assets/css/bs4/bootstrap.min.css”,
“dt_bs4” : “/assets/js/libs/dt_bs4/datatables.min.css”,
“ico_bs4” : “/assets/css/bs4/glyphicons.css”
},
“js”:
{
“main” : “/assets/js/script.js”,
“plugin” : “/assets/js/plugins.js”,
“wordcount” : “/assets/js/wordcount.min.js”,
“draggable” : “/assets/js/draggable.min.js”,
“jq” : “/assets/js/libs/jquery-3.4.1.min.js”,
“bs3” : “/assets/js/libs/bs3/bootstrap.min.js”,
“dt_bs3” : “/assets/js/libs/dt_bs3/datatables.min.js”,
“bs4” : “/assets/js/libs/bs4/bootstrap.min.js”,
“bs4bun” : “/assets/js/libs/bs4/bootstrap.bundle.min.js”,
“dt_bs4” : “/assets/js/libs/dt_bs4/datatables.min.js”
}
}
};
}

public void function afterConfigurationLoad(event, struct interceptData, buffer, rc, prc){
var appStorage = wirebox.getInstance(“applicationStorage@cbstorages”);
appStorage.set(“assets”, readAssetLastModified());
writelog(type=“information”, file=“testdebug”, text=“run assets register…”);
}

private struct function readAssetLastModified(){
return settings.assets.map(function(assetType,assetFiles){
return assetFiles.map(addVersionToFileName);
});
}

private function addVersionToFileName(assetName,filePath){
return filePath & “?v” & hash( fileInfo( expandpath(filePath) ).dateLastModified );
}

`