add mod name to js print() (#1677)

* add mod name to js print()

* add mod name to errors
This commit is contained in:
Anuken 2020-03-05 15:58:10 -05:00 committed by GitHub
parent 0534a4da45
commit 89a5c957fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -5,7 +5,7 @@ const log = function(context, obj){
var scriptName = "base.js"
var modName = "none"
const print = text => log(scriptName, text);
const print = text => log(modName + "/" + scriptName, text);
const extendContent = function(classType, name, params){
return new JavaAdapter(classType, params, name)

View File

@ -91,6 +91,9 @@ public class Scripts implements Disposable{
context.evaluateString(scope, script, file, 1, null);
return true;
}catch(Throwable t){
if(currentMod != null){
file = currentMod.name + "/" + file;
}
log(LogLevel.err, file, "" + getError(t));
return false;
}