sieukrem / jn-npp-plugin

Plugin for Notepad++ allowing you to automate some tasks using JavaScript
https://github.com/sieukrem/jn-npp-plugin/wiki
110 stars 24 forks source link

Little information about where the error occurred/Мало информации о месте возникновения ошибки #95

Open trdm opened 4 years ago

trdm commented 4 years ago

How to determine the place where a script execution error occurred. I’m attaching a screenshot. https://prnt.sc/t3n6uh I use my set of scripts, I am ready to provide it for playback. I will try to catch the place of the error by debugging. However, more information about the localization of the error will not hurt ..

sieukrem commented 4 years ago

I assume you execute your Scripts by calling eval. If des, then use addScript. You will find example in jn/start.js

trdm commented 4 years ago

I assume you execute your Scripts by calling eval. If des, then use addScript. You will find example in jn/start.js

No, I do not use 'eval' in my scripts.

sieukrem commented 4 years ago

How can I reproduce the issue?

trdm commented 4 years ago

Something like this.

var gNjPluginDir = Editor.nppDir + "\\plugins\\jN\\";
var gFSO = new ActiveXObject("Scripting.FileSystemObject");
var gNjPluginDir2 = gNjPluginDir + "Intell\\";

function f1() {
    var vFileName = gNjPluginDir+"Intell\\_progIdDumped.dict";
    // Директории 'Intell' не существует в директории gNjPluginDir
    var vFile = gFso.CreateTextFile(vFileName,false); // << ошибка тут.
}

f1();

In the test script, a slightly different type of error is obtained. Место возникновения: https://github.com/trdm/jn-npp-scripts/blob/8303b88be670d75936fbf26403a9b8c256d6ecb1/includes/intelOle.js#L373

Полагаю связано с переездом скриптов в поддиректорию. у меня в папке jN хранились данные для скриптов.

sieukrem commented 4 years ago

For me is working fine within a file opend in npp and executed via F5

2020-06-22 11_37_55-Window

trdm commented 4 years ago

https://prnt.sc/t48win Maybe because the error occurs in the function of the object? Может из-за того, что ошибка происходит в функции объекта? https://prnt.sc/t48ybi

trdm commented 4 years ago

gif with an error. https://github.com/trdm/jn-npp-scripts/blob/master/Help/20200622-14-12.gif