MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / fail

Function fail

vm/ByteCodeTranslator/src/javascript/parparvm_runtime.js:2290–2329  ·  view source on GitHub ↗
(error)

Source from the content-addressed store, hash-verified

2288 emitVmMessage({ type: this.protocol.messages.RESULT, result: result });
2289 },
2290 fail(error) {
2291 const message = formatErrorForVm(error);
2292 let virtualFailure = this.lastVirtualFailure;
2293 if (!virtualFailure) {
2294 const parsed = parseMissingVirtualMessage(message);
2295 if (parsed) {
2296 virtualFailure = {
2297 category: parsed.receiverClass === "undefined" || parsed.receiverClass === "null"
2298 ? "missing_receiver"
2299 : "missing_class_method",
2300 methodId: parsed.methodId,
2301 receiverClass: parsed.receiverClass
2302 };
2303 }
2304 }
2305 if (!this.firstFailure) {
2306 this.firstFailure = {
2307 category: virtualFailure && virtualFailure.category ? virtualFailure.category : "runtime_error",
2308 methodId: virtualFailure && virtualFailure.methodId ? virtualFailure.methodId : "",
2309 receiverClass: virtualFailure && virtualFailure.receiverClass ? virtualFailure.receiverClass : ""
2310 };
2311 vmDiag("FIRST_FAILURE", "category", this.firstFailure.category);
2312 vmDiag("FIRST_FAILURE", "methodId", this.firstFailure.methodId || "none");
2313 vmDiag("FIRST_FAILURE", "receiverClass", this.firstFailure.receiverClass || "none");
2314 }
2315 let stack = error && error.stack ? error.stack : null;
2316 if (!stack && error && typeof error === "object") {
2317 const javaStack = error[CN1_THROWABLE_STACK];
2318 if (javaStack) {
2319 try { stack = jvm.toNativeString(javaStack); }
2320 catch (_es) { stack = String(javaStack); }
2321 }
2322 }
2323 emitVmMessage({
2324 type: this.protocol.messages.ERROR,
2325 message: message,
2326 stack: stack,
2327 virtualFailure: virtualFailure || null
2328 });
2329 },
2330 invokeHostNative(symbol, args) {
2331 this.__cn1HostCallCount = (this.__cn1HostCallCount | 0) + 1;
2332 return { op: this.protocol.messages.HOST_CALL, id: this.nextHostCallId++, symbol: symbol, args: args || [] };

Callers

nothing calls this directly

Calls 5

formatErrorForVmFunction · 0.85
vmDiagFunction · 0.85
emitVmMessageFunction · 0.85
StringClass · 0.50

Tested by

no test coverage detected