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

Function fx_Error_toString

xs/sources/xsError.c:306–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306void fx_Error_toString(txMachine* the)
307{
308 txSlot* name;
309 txSlot* message;
310 if (mxThis->kind != XS_REFERENCE_KIND)
311 mxTypeError("this: not an object");
312 mxPushSlot(mxThis);
313 mxGetID(mxID(_name));
314 if (the->stack->kind == XS_UNDEFINED_KIND)
315 fxStringX(the, the->stack, "Error");
316 else
317 fxToString(the, the->stack);
318 name = the->stack;
319 mxPushSlot(mxThis);
320 mxGetID(mxID(_message));
321 if (the->stack->kind == XS_UNDEFINED_KIND)
322 *the->stack = mxEmptyString;
323 else
324 fxToString(the, the->stack);
325 message = the->stack;
326 if (c_isEmpty(name->value.string))
327 *mxResult = *message;
328 else if (c_isEmpty(message->value.string))
329 *mxResult = *name;
330 else {
331 fxStringX(the, mxResult, "");
332 fxConcatString(the, mxResult, name);
333 fxConcatStringC(the, mxResult, ": ");
334 fxConcatString(the, mxResult, message);
335 }
336 the->stack += 2;
337}
338
339void fx_AggregateError(txMachine* the)
340{

Callers

nothing calls this directly

Calls 4

fxStringXFunction · 0.85
fxToStringFunction · 0.85
fxConcatStringFunction · 0.85
fxConcatStringCFunction · 0.85

Tested by

no test coverage detected