atuttle / Taffy

:candy: The REST Web Service framework for ColdFusion and Lucee
http://taffy.io
Other
226 stars 118 forks source link

api.cfc super.onError() having issue #386

Closed tkiansoon closed 4 years ago

tkiansoon commented 5 years ago

I tried to handle errors on unhandled path page within my Application with onError() function, I inherit super.onError() to handle taffy requests, somehow I got an error on line 132: string component [Application] has no private function with name [onError]

Is there a reason to call super.onError( arguments.exception )? api.cfc doesn't inherit any components and therefore super failed. Correct me if I'm wrong.

tkiansoon commented 5 years ago

So this is what I did in my Application to solve the issue: public void function onError(required Any exception, required string eventName) { try { if (!structKeyExists(request, 'unhandled') or request.unhandled eq false) { super.onError(event = arguments.eventName, exception = arguments.exception); } else { // handles my custom errors here } } catch (any err) { } }

atuttle commented 4 years ago

@tkiansoon I'm curious why you make reference to unhandled paths. Taffy does implement onError() so if you override it you should call super.onError(exception).

I recognize that this post is more than a year old. Sorry for not replying sooner. That's entirely my fault. :(

Since the likelihood of a reply from you this far down the line is so unlikely I'm going to close the issue, but if by some chance you'd like to continue the discussion, just reply and we'll pick it back up.