Application onError doesn't catch missinginclude error

Hi,
in my Application.cfc I have an onMissingTemplate and an onError Block:

public void function onMissingTemplate(String targetPage){
include “404.cfm”;
}

public void function onError(Any Exception, String EventName){
include “500.cfm”;
}

But if I hit www.example.com/.cfm
which is a test from Qualys, it renders the default error page from Lucee
showing a missinginclude error, with stracktrace etc.
Lucee Version 4.5.1.022

I have this happening to me…did you ever figure out a solution?

In the onMissingTemplate handler are you returning true.

I think that’s needed to tell the system you’ve handled it and it doesn’t need to onError

We have

public boolean function onMissingTemplate (required string targetPage) {
	header statuscode=404;
	if (Session?.userId > 0) {
		include "_index/templates/404-LoggedIn.cfm";
	} else {
		include "_index/templates/404.cfm";
	}
	return true;
}

Thank you for the quick response…I will give that a shot. And for more context I am using Coldbox which is handling the 404 but I am guessing to your point it is returning false to throw the onError.

public boolean function onMissingTemplate( template ){
return application.cbBootstrap.onMissingTemplate( argumentCollection=arguments );
}