The raygun4cfml provider

Raygun4cfml is a library that you can easily add to your ColdFusion application, which will then allow you to transmit all exceptions to your Raygun.io dashboard. Installation is simple, and configuring your site to transmit errors takes only 5 minutes.

Raygun4cfml is confirmed on ColdFusion 9 and 10.

How do I get started with raygun4cfml?

Here's an overview:

  1. Clone the GitHub repository, available below, and add it to your project.
  2. Create an instance of RaygunClient, passing in your API key (available from your dashboard.
  3. Call the send() function, passing in your error. You can call this from the onError event in Application.cfc to do this automatically when an error isn't caught by a try-catch block. Easy!

Example error handler

The following is an example for use in a global error handler template e.g cferror. It also demonstrates how you can add custom data to every message delivered to Raygun.

  <cfscript>
    sessionData = {"memberID" = "5747854", "memberFirstName" = "test"};
    paramsData = {"currentAction" = "IwasDoingThis", "justAnotherParam" = "test"};
    customRequestData = createObject("nz.co.ventego-creative.raygun4cfml.RaygunCustomData").init(sessionData,paramsData);

    raygun = createObject("component","nz.co.ventego-creative.raygun4cfml.RaygunClient").init(
        apiKey = "YOURAPIKEYHERE",
        customRequestData = customRequestData
    );

        result = raygun.send(error);
</cfscript>

Raygun4cfml GitHub Repository

To get the source code, visit the GitHub repository here.