-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output all error messages to the debug console #60
Comments
I'm wondering if you have contacted lexikos to propose that these obstacles are resolved by future AHK releases? |
Basically, I think this problem is something I should solve. What I would like to do is not to show the error dialog, instead I would like the stderr to output a message containing the call stack, and I would like the error message to show Only the users of my extension would greatly benefit from solving this. |
I don't think that's a very good explanation now that I see it, so I'll add. The reasons for and benefits of implementation.
Other ideas, such as embedding libraries such as UnitTest, are also available, but they are not practical ideas yet. In any case, it is a draft feature and is a low priority to implement. |
OK - appreciate the update |
You may have noticed: /Include was added in v1.1.34 and v2.0-a135 for things like this. If the debugger was using its own copy of AutoHotkey.exe, it could also be done by embedding the library as RCDATA resource ID 2. The Stack property was added in v2.0-a125. It is also possible to detect the construction of new Error objects (even by built-in code) in v2.0-a125+ by hooking
The debugger client could probably do that without injecting or modifying script, if it had the use of exception breakpoints, which are supported within the DBGP spec but not my current implementation. I have intended to add support for it for a long time, but it's never been a particularly appealing project, given that making use of it would mean also adding support in a debugger client. I think implementing support within the engine would probably be relatively trivial. The DBGP spec was updated on 2021-05-04 to add I don't see any way within the DBGP spec to communicate the actual exception value or message, only the exception name (type?). I would probably implement a pseudo-property which could be retrieved by |
I just checked. This is convenient.
It's interesting how to pseudo detect the occurrence of a exception by hooking the creation of an error object. The side effects might be a concern for actual use.
Exception breakpoints are a very desired feature for debug adapter creators.
I also checked the spec, and indeed there is no way to notify the error message. I agree with you about using pseudo-properties as a solution. I have the impression that DBGP is a PHP-only protocol, although it is called "common debugger protocol", so I guess they didn't include it in the specification because error message retrieval can be solved on the language side. |
This issue can be easily solved by using the However, this argument can only specify one script, so if the debugger adapter uses it, the user will not be free to include external scripts. Therefore, the solution is to create a temporary script that combines specified scripts, and specify it in |
Supporting multiple didn't seem to be worth the extra development time and increase in code size. It is intended mainly for use by programs or scripts and not direct use by a user at a command prompt, so convenience isn't much of a factor. If multiple files are required, If stdin isn't being used for something else, |
Thanks. The information in I will add a new launch.json attribute that wraps |
When using However, they cannot be used for debugging purposes because they make the script wait until it finishes. Therefore, when specifying two or more files, I will implement the method of creating a temp file as initially planned. |
AutoHotkey does not output all error messages to stderr. Also another problem is that a dialog box is generated when an error occurs.
Currently, users need to build a library into their scripts to solve these problems.
So I came up with a way to embed the library when debugging.
However, it is not possible to load the library dynamically, so the following tricks are required.
program
to the temp folder and add the include statement for the specified library and rewrite the path to all #Include statements in theprogram
This makes it possible to embed the library without the user being aware of it.
There are two libraries that solve the problem. This is modified and used.
The problem with this solution is that it is very labor intensive. Like the trick itself, you'll need to have a library for the each version of AutoHotkey.
Therefore, it may not be implemented immediately.
The text was updated successfully, but these errors were encountered: