| 12581 | |
| 12582 | |
| 12583 | IObject *Line::CreateRuntimeException(LPCTSTR aErrorText, LPCTSTR aExtraInfo, Object *aPrototype) |
| 12584 | { |
| 12585 | // Build the parameters for Object::Create() |
| 12586 | ExprTokenType aParams[3]; int aParamCount = 2; |
| 12587 | ExprTokenType* aParam[3] { aParams + 0, aParams + 1, aParams + 2 }; |
| 12588 | aParams[0].SetValue(const_cast<LPTSTR>(aErrorText)); |
| 12589 | #ifdef CONFIG_DEBUGGER |
| 12590 | aParams[1].SetValue(const_cast<LPTSTR>(g_Debugger.WhatThrew())); |
| 12591 | #else |
| 12592 | // Without the debugger stack, there's no good way to determine what's throwing. It could be: |
| 12593 | //g_act[mActionType].Name; // A command implemented as an Action (g_act). |
| 12594 | //g->CurrentFunc->mName; // A user-defined function (perhaps when mActionType == ACT_THROW). |
| 12595 | //???; // A built-in function implemented as a Func (g_BIF). |
| 12596 | aParams[1].SetValue(_T(""), 0); |
| 12597 | #endif |
| 12598 | if (aExtraInfo && *aExtraInfo) |
| 12599 | aParams[aParamCount++].SetValue(const_cast<LPTSTR>(aExtraInfo)); |
| 12600 | |
| 12601 | auto obj = Object::Create(); |
| 12602 | if (!obj) |
| 12603 | return nullptr; |
| 12604 | if (!aPrototype) |
| 12605 | aPrototype = ErrorPrototype::Error; |
| 12606 | obj->SetBase(aPrototype); |
| 12607 | FuncResult rt; |
| 12608 | g_script.mCurrLine = this; |
| 12609 | if (!obj->Construct(rt, aParam, aParamCount)) |
| 12610 | return nullptr; |
| 12611 | return obj; |
| 12612 | } |
| 12613 | |
| 12614 | |
| 12615 | ResultType Line::ThrowRuntimeException(LPCTSTR aErrorText, LPCTSTR aExtraInfo) |
no test coverage detected