Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions public/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,20 @@ component output="false" {
}

public void function onError( any Exception, string EventName ) {
injector = new wheels.Injector("wheels.Bindings");
application.wo = injector.getInstance("global");
try {
injector = new wheels.Injector("wheels.Bindings");
application.wo = injector.getInstance("global");

// Make exception available to the event template
request.wheels = request.wheels ?: {};
request.wheels.exception = Exception;
request.wheels.eventName = EventName;

// Run early error event if it exists
application.wo.$include(template = "/wheels/events/onerror/onerrorstart.cfm");
} catch (any e) {
// Must never break error handling
}

// In case the error was caused by a timeout we have to add extra time for error handling.
// We have to check if onErrorRequestTimeout exists since errors can be triggered before the application.wheels struct has been created.
Expand Down
8 changes: 8 additions & 0 deletions vendor/wheels/events/onerror/onerrorstart.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<cfif structKeyExists(request.wheels, "exception")>
<cflog
file="wheels-errors"
type="error"
text="#request.wheels.exception.message#
#request.wheels.exception.detail#"
>
</cfif>