MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxEchoException

Function fxEchoException

xs/sources/xsDebug.c:1365–1430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1363}
1364
1365void fxEchoException(txMachine* the, txSlot* exception)
1366{
1367 switch (exception->kind) {
1368 case XS_REFERENCE_KIND: {
1369 txSlot* instance = exception->value.reference;
1370 txSlot* internal = instance->next;
1371 if (internal && (internal->kind == XS_ERROR_KIND)) {
1372 switch (internal->value.error.which) {
1373 case XS_UNKNOWN_ERROR: fxEcho(the, "Error"); break;
1374 case XS_EVAL_ERROR: fxEcho(the, "EvalError"); break;
1375 case XS_RANGE_ERROR: fxEcho(the, "RangeError"); break;
1376 case XS_REFERENCE_ERROR: fxEcho(the, "ReferenceError"); break;
1377 case XS_SYNTAX_ERROR: fxEcho(the, "SyntaxError"); break;
1378 case XS_TYPE_ERROR: fxEcho(the, "TypeError"); break;
1379 case XS_URI_ERROR: fxEcho(the, "URIError"); break;
1380 case XS_AGGREGATE_ERROR: fxEcho(the, "AggregateError"); break;
1381 case XS_SUPPRESSED_ERROR: fxEcho(the, "SuppressedError"); break;
1382 }
1383 fxEcho(the, ": ");
1384 internal = internal->next;
1385 if (internal && ((internal->kind == XS_STRING_KIND) || (internal->kind == XS_STRING_X_KIND))) {
1386 fxEchoString(the, internal->value.string);
1387 }
1388 }
1389 else {
1390 fxEcho(the, "(");
1391 if (instance->flag & XS_CAN_CALL_FLAG)
1392 fxEcho(the, mxFunctionString.value.string);
1393 else
1394 fxEcho(the, mxObjectString.value.string);
1395 fxEcho(the, ")");
1396 }
1397 } break;
1398 case XS_UNDEFINED_KIND:
1399 fxEcho(the, "undefined");
1400 break;
1401 case XS_NULL_KIND:
1402 fxEcho(the, "null");
1403 break;
1404 case XS_BOOLEAN_KIND:
1405 if (exception->value.boolean)
1406 fxEcho(the, "true");
1407 else
1408 fxEcho(the, "false");
1409 break;
1410 case XS_INTEGER_KIND:
1411 fxEchoInteger(the, exception->value.integer);
1412 break;
1413 case XS_NUMBER_KIND:
1414 fxEchoNumber(the, exception->value.number);
1415 break;
1416 case XS_STRING_KIND:
1417 case XS_STRING_X_KIND:
1418 fxEchoString(the, exception->value.string);
1419 break;
1420 case XS_SYMBOL_KIND:
1421 fxEcho(the, "Symbol(");
1422 fxEchoString(the, fxGetKeyString(the, exception->value.symbol, C_NULL));

Callers 3

fxDebugEvalFunction · 0.85
fxDebugLineFunction · 0.85
fxDebugLoopFunction · 0.85

Calls 6

fxEchoFunction · 0.85
fxEchoStringFunction · 0.85
fxEchoIntegerFunction · 0.85
fxEchoNumberFunction · 0.85
fxGetKeyStringFunction · 0.85
fxEchoBigIntFunction · 0.85

Tested by

no test coverage detected