示例#1
0
文件: IoCoroutine.c 项目: jdp/io
void IoCoroutine_rawPrintBackTrace(IoCoroutine *self)
{
	IoObject *e = IoCoroutine_rawException(self);
	IoMessage *caughtMessage = IoObject_rawGetSlot_(e, IOSYMBOL("caughtMessage"));

	if (IoObject_rawGetSlot_(e, IOSYMBOL("showStack"))) // sanity check
	{
		IoState_on_doCString_withLabel_(IOSTATE, e, "showStack", "[Coroutine]");
	}
	else
	{
		IoSymbol *error = IoObject_rawGetSlot_(e, IOSYMBOL("error"));

		if (error)
		{
			fputs(CSTRING(error), stderr);
			fputs("\n", stderr);
		}
		else
		{
			fputs("error: [missing error slot in Exception object]\n", stderr);
		}

		if (caughtMessage)
		{
			UArray *ba = IoMessage_asMinimalStackEntryDescription(caughtMessage);
			fputs(UArray_asCString(ba), stderr);
			fputs("\n", stderr);
			UArray_free(ba);
		}
	}
}
示例#2
0
void IoMessage_print(IoMessage *self)
{
	UArray *ba = IoMessage_description(self);

	//printf("%s\n", UArray_asCString(ba));
	IoState_print_(IOSTATE, UArray_asCString(ba));
	UArray_free(ba);
}