Skip to main content
Inspiring
July 17, 2013
Question

How's my error handling?

  • July 17, 2013
  • 1 reply
  • 813 views

I'll keep this short.

I have TONS of CFTRY/CFCATCH blocks encapsulating different logic.  In the event an error throws, I send the CFCATCH data and usually a descriptive message along with the invokation to a custom tag called cf_errorhandler.  I haven't coded the logic yet in that page, but I'm wondering if this sounds convoluted.

I understand that this will only address 'caught' exceptions, and I will utilize the onError method in the application.cfc for unhandled exception handling, but I'd love to hear other people's input on how their error handler for caught exceptions work.

It's just that I get this feeling that I'm doing it the hard way.

    This topic has been closed for replies.

    1 reply

    p_sim
    Participating Frequently
    July 17, 2013

    I use cftry/cfcatch to handle events that are out of my controls such as accessing filesystem, calling third-party APIs, and so on.

    Try to use existing frameworks such as Fusebox, ColdBox, CFWheels because the mechanism to handle errors is already built-in.

    Inspiring
    July 17, 2013

    I've had a lot of people telling me to use frameworks.  As a person with a non-traditional upbringing into coding, I've found all their websites to be equally confusing as to explaining what they are, and how to get started with them.  They seem to equally assume you know vast amounts of ColdFusion's most advanced syntax and code, and the way they present their framework has been confusing at every turn.

    Like how CF was so much easier to pick than Java or .NET, I was hoping a framework would simplify my web applications, but instead, they seem to be mired in an advanced OOP methodology (which chances are, IS the way to do programming, but isn't where I am yet, so I'm having a hard time comprehending it)

    I guess I need to start somewhere.  I think if I can find a website that doesn't a better job teaching than the framework's website (who are notorious for documentation that talks well beyond me and a lack of systematic tutorials to get me acclimated to using the system).....that might help me get my feet wet.

    p_sim
    Participating Frequently
    July 17, 2013

    Frameworks:

    Let me share my experience. I had the same issues with frameworks as you described above. Some frameworks, such as Mach-II and ColdBox. They use a lot of technical terms that way above my head. However, there are frameworks like Fusebox and FW/1 that give us minimum learning curves.

    My favorite is Fusebox 5.x which I can use in either OOP or non-OOP approach. At first, I used it to separate logic from the view. As my ColdFusion and programming skills developed, I started OOP. It provided me a smooth transition.

    Using framework, I can spend more of my time to "what to build" instead of "how to build." And, it does simplify mechanism of applications. Let say, in Fusebox, there is a something wrong with adding items in shopping cart. I can quickly pin point where I should look for the problem.

    Good luck!