gj :: locateUse gj :: locate to get to the source of your errors. Using VS Code, with either the Serenji extension or the basic InterSystems ObjectScript extension, click on the gj :: locate caption in the status bar. Enter an ObjectScript error message or a line reference from a class or .mac routine. Then gj :: locate will take you directly to the corresponding line in your source code. FeaturesDebugging 101The first step in debugging any error is to make sure you are looking at the correct line of code. Error messages give the error location in terms of the compiled .int code, not your source code. There are many special rules about how lines of source code map to corresponding lines in the compiled .int routines and most people don't know them all. Locating the correct source line for an error is an essential first step in debugging any problem. gj :: locate solves this problem by converting the location of an error in compiled .int code to the corresponding location in your source, and then taking you there. Simply copy and paste any InterSystems IRIS error message into gj :: locate and it will take you directly to the corresponding source line. But wait, there's more!It doesn't just work with error messages. You can use gj :: locate to open any class or routine and go straight to the line you want. For example, you can enter You can specify a location using any of these formats to get quickly and directly to where you want to be:
And one more thing...If you install the gj :: locate userscript in your browser, you can navigate seamlessly from an error message in the Management Portal Application Error Log to the source code in just two clicks. Like this: RequirementsThis extension requires either the Serenji extension or the basic InterSystems ObjectScript extension to be installed. Installation
Optionally install the gj :: locate UserscriptIf you install the gj :: locate userscript in your browser, you will be able to copy error messages from any InterSystems Management Portal (all versions of IRIS, Ensemble and Caché going back to 2007) and paste them into VS Code with just two clicks
Why?Surely it can't be that difficult to get from Take, for example, the following error message:
It's 2:30am and you've just been woken up to fix a mission critical problem in your Greek Alphabet application. How do you find the corresponding source code line for this error? First you have to know a few things. Like, you have to know that when a routine ends with a period followed by a number it means it's a class, not a routine. So now you go open up Greek.Alphabet.cls. Yes, the error message says the problem is in the Greek.Alphabet class, but as you can see, it's empty. Closer inspection reveals that the source code must have come from one of the superclasses. Greek.Zeta.cls would be a good guess. Let's look in there. Well, here we are. It's obviously line 10 which is It's now 3am and you are feeling a bit challenged! Then you remember! Methods are given a Let's look at Greek.Eta.cls Hmm. It's nearly identical to Greek.Zeta.cls and More head scratching. Perhaps the problem is something to do with that Line 5 looks promising. But... oh no, So, eventually, after scolling down 20 or so lines you find some more code: Now we know why The real error is at line 25 of Greek.Utils.inc. This is a somewhat contrived example that spotlights some of the many gotchas you might encounter. Getting from an error message to the corresponding source line can be difficult, especially at 3am. So finally, here's how you'd do it with gj :: locate Known Limitations and IssuesThe source location is determined using an empirical method. This approach has a number of limitations that are unlikely to be encountered in most normal cases. If however, you are doing something exotic, the results may be affected. Generally, using the Serenji extension instead of the basic InterSystems ObjectScript extension will give better results because it is able to access source code that has not been downloaded to the client.
Release NotesSee CHANGELOG. |