in src/webdemo-api.js [140:193]
static executeKotlinCode(
code,
compilerVersion,
platform,
args,
theme,
hiddenDependencies,
onTestPassed,
onTestFailed,
) {
return executeCode(
API_URLS.COMPILE(platform, compilerVersion),
code,
compilerVersion,
platform,
args,
hiddenDependencies,
).then(function (data) {
let output = '';
let errorsAndWarnings = flatten(Object.values(data.errors));
let errors = errorsAndWarnings.filter(
(error) => error.severity === 'ERROR',
);
if (errors.length > 0) {
output = processErrors(errors, theme);
} else {
switch (platform) {
case TargetPlatforms.JAVA:
if (data.text) output = processJVMOutput(data.text, theme);
break;
case TargetPlatforms.JUNIT:
data.testResults
? (output = processJUnitResults(
data.testResults,
onTestPassed,
onTestFailed,
))
: (output = processJVMOutput(data.text || '', theme));
break;
}
}
let exceptions = null;
if (data.exception != null) {
exceptions = findSecurityException(data.exception);
exceptions.causes = getExceptionCauses(exceptions);
exceptions.cause = undefined;
}
return {
errors: errorsAndWarnings,
output: output,
exception: exceptions,
};
});
}