Sublime Forum

How to use error trace to quickly go to a file and line?

#1

I am using Sublime on Windows 10 to build project on a Debian machine which I access using SmarTTY. I’m currently working on a website written in PHP which dumps error trace to a database, which I then retrieve via a TTY terminal. I’m musing on how I could somehow take the trace and use it to quickly and easily navigate in Sublime to the reported source of the error. An example of real error trace is as follows:

err_id     : MPEuxyeMhLqGn9wK3EprRQtzHPaUS8mkB4Y
        err_detail : 
            0: 
                type     : Throwable
                class    : Error
                code     : 0
                file     : modules/cms/CAssets.php
                line     : 86
                message  : __clone method called on non-object
                trace_str: #0 modules/cms/cms-funcs.php(25): modules\cms\CAssets->getCurrentAsset()
                           #1 public_html/index.php(23): modules\cms\serve()
                           #2 {main}
        err_counter: 264
        err_latest : 2023-11-21 20:13:38.000

As you can see, the error is at line 86 of the file modules/cms/CAssets.php w.r.t. the project root. I am thinking if I could format the error file and line number in such a way as to be able to copy-and-paste it into a search box in Sublime that would recognise that I need that file at that line and would then open the file and scroll to the line, then that would be extremely useful!

Any ideas as to how I could do that? Currently I am doing it by hand (scrolling to the file myself and finding the line by hand).

I’m aware of CTRL+P (Goto anything) where I can copy and paste the filename, then CTRL+G to take me to line 86. That works well, but I can’t figure out how to get it to take me to line 86 (which could be line 1186 for big files) in file CAssets.php with a single search. I’ve tried such things as “CAssets.php 86”, “CAssets.php line 86”, “CAssets.php [86]”, “CAssets.php (86)”, etc, but no luck so far.

0 Likes

#2

The search syntax is path:line so you just add :86.

1 Like