We got another error message from the single sign-on script. We'd been getting 2 or 3 a day for a couple of weeks, and it was finally agitating enough to pull me away from the normal to do list and take a look at it.
The first thing to do was get some better feedback out of the script itself. I'd written it, and it was a one-time job for our internal use, so I knew I'd put in some
LousyErrorMessages, or rather didn't put in any good ones, which left us pretty dry.
The current error was the Ruby version of a null pointer exception: “undefined method ‘attributes’ for nil”. So I dug into the code, figured out where the nil object was and added some lines to check for a nil object and raise an error giving more info.
The script talks XML over HTTP to a third-party web application's API to manipulate user data. The code assumed it would always get valid XML returned to it, extract an element and then read off some attributes. My change to the script now checked for a valid element object found in the XML, and if it wasn't found, raise an error that dumped out the raw XML data returned from the API call.
Unfortunately, it'd probably be another half to full day before I could see the change in action. When the errors start flying, the only known workaround to the problem is to restart the third-party web application. After that, the problems go away for a while. So, back to normal work.
(to be continued...) [Well, I should've finished this back when this was fresher in my mind - it's lost now...]
(wip)
tags:
ComputersAndTechnology