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

Function fx_Error_aux

xs/sources/xsError.c:272–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272txSlot* fx_Error_aux(txMachine* the, txError error, txInteger i)
273{
274 txSlot* instance;
275 txSlot* slot;
276 if (!mxHasTarget)
277 mxPushSlot(mxFunction);
278 else
279 mxPushSlot(mxTarget);
280 fxGetPrototypeFromConstructor(the, &mxErrorPrototypes(error));
281 instance = fxNewObjectInstance(the);
282 mxPullSlot(mxResult);
283 slot = instance->next = fxNewSlot(the);
284 slot->flag = XS_INTERNAL_FLAG;
285 slot->kind = XS_ERROR_KIND;
286 slot->value.error.info = C_NULL;
287 slot->value.error.which = error;
288 if (gxDefaults.captureErrorStack)
289 gxDefaults.captureErrorStack(the, slot, the->frame->next);
290 if ((mxArgc > i) && (mxArgv(i)->kind != XS_UNDEFINED_KIND)) {
291 fxToString(the, mxArgv(i));
292 slot = fxNextSlotProperty(the, slot, mxArgv(i), mxID(_message), XS_DONT_ENUM_FLAG);
293 }
294 i++;
295 if ((mxArgc > i) && (mxArgv(i)->kind == XS_REFERENCE_KIND)) {
296 if (mxBehaviorHasProperty(the, mxArgv(i)->value.reference, mxID(_cause), 0)) {
297 mxPushSlot(mxArgv(i));
298 mxGetID(mxID(_cause));
299 slot = fxNextSlotProperty(the, slot, the->stack, mxID(_cause), XS_DONT_ENUM_FLAG);
300 mxPop();
301 }
302 }
303 return slot;
304}
305
306void fx_Error_toString(txMachine* the)
307{

Callers 9

fx_ErrorFunction · 0.85
fx_AggregateErrorFunction · 0.85
fx_EvalErrorFunction · 0.85
fx_RangeErrorFunction · 0.85
fx_ReferenceErrorFunction · 0.85
fx_SyntaxErrorFunction · 0.85
fx_TypeErrorFunction · 0.85
fx_URIErrorFunction · 0.85
fx_SuppressedErrorFunction · 0.85

Calls 5

fxNewObjectInstanceFunction · 0.85
fxNewSlotFunction · 0.85
fxToStringFunction · 0.85
fxNextSlotPropertyFunction · 0.85

Tested by

no test coverage detected