NotificationDisplay: fix improper state mark for "expand" (WIP)
test_meta_markAction always produces a state mark with payload type string. However, the model::Tangible expects a bool payload when handling the "expand" mark. - add diagnostics to lib::variant to indicate expected and actual payload type - attempt to fix with boost::lexical_cast; this is insufficient, since you'd expect such a function to understand "true" and "false" etc. Moreover, raising this exception causes emergency shutdown, which flounders due to triggering a ZombieCheck. Interesting.
This commit is contained in:
parent
f9c6a49b9b
commit
23430f8800
3 changed files with 102 additions and 5 deletions
|
|
@ -341,15 +341,16 @@ namespace lib {
|
|||
|
||||
|
||||
|
||||
static string indicateTypeMismatch (Buffer&);
|
||||
|
||||
|
||||
static Buff&
|
||||
downcast (Buffer& b)
|
||||
{
|
||||
Buff* buff = dynamic_cast<Buff*> (&b);
|
||||
|
||||
if (!buff)
|
||||
throw error::Logic("Variant type mismatch: "
|
||||
"the given variant record does not hold "
|
||||
"a value of the type requested here"
|
||||
throw error::Logic(indicateTypeMismatch(b)
|
||||
,error::LERR_(WRONG_TYPE));
|
||||
else
|
||||
return *buff;
|
||||
|
|
@ -550,6 +551,27 @@ namespace lib {
|
|||
return util::typedString (this->access());
|
||||
}
|
||||
|
||||
/**
|
||||
* error message when accessing the variant content with wrong type assumptions.
|
||||
* @remark while this diagnostics can be crucial for finding bugs, we avoid
|
||||
* including \ref format-string.hpp, since lib::Variant is used pervasively
|
||||
* as part of lib::diff::GenNode. Especially in development builds, we observed
|
||||
* a tangible leverage on executable size. Thus we implement the protection
|
||||
* against follow-up exceptions explicitly here.
|
||||
*/
|
||||
template<typename TYPES>
|
||||
template<typename TY>
|
||||
inline string
|
||||
Variant<TYPES>::Buff<TY>::indicateTypeMismatch(Variant<TYPES>::Buffer& target)
|
||||
{
|
||||
try {
|
||||
return "Variant type mismatch: expected value of type «"
|
||||
+ lib::meta::typeStr<TY>()+"», "
|
||||
+ "however the given variant record is "
|
||||
+ string{target};
|
||||
}
|
||||
catch(...) { return lib::meta::FAILURE_INDICATOR; }
|
||||
}
|
||||
|
||||
|
||||
}// namespace lib
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include "lib/format-string.hpp" //////////////////////////////////////////////////////////////TICKET #1099 : include needed temporarily
|
||||
//#include "lib/symbol.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <string>
|
||||
|
||||
using lib::hash::LuidH;
|
||||
|
|
@ -58,6 +59,7 @@ using lib::diff::GenNode;
|
|||
//using util::cStr;
|
||||
using util::_Fmt; //////////////////////////////////////////////////////////////TICKET #1099 : include needed temporarily
|
||||
using std::string;
|
||||
using boost::lexical_cast;
|
||||
|
||||
|
||||
namespace proc {
|
||||
|
|
@ -211,7 +213,9 @@ COMMAND_DEFINITION (test_meta_markAction)
|
|||
def.operation ([](string actionID, string message)
|
||||
{
|
||||
ID errorLogID = gui::interact::Wizard::getErrorLogID();
|
||||
GuiNotification::facade().mark (errorLogID, GenNode{actionID, message});
|
||||
GuiNotification::facade().mark (errorLogID
|
||||
,actionID=="expand"? GenNode{actionID, lexical_cast<bool> (message)} ///////////FIXME : lexical_cast is not suitable. We need a generic bool parse function!
|
||||
: GenNode{actionID, message});
|
||||
})
|
||||
.captureUndo ([](string actionID, string message) -> string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2911,7 +2911,7 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1533689255174" FOLDED="true" ID="ID_821013695" MODIFIED="1538263469674" TEXT="Aufruf via Notification_Facade">
|
||||
<node COLOR="#338800" CREATED="1533689255174" ID="ID_821013695" MODIFIED="1538281518697" TEXT="Aufruf via Notification_Facade">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#338800" CREATED="1537835197558" ID="ID_1477928890" MODIFIED="1538263469674" TEXT="displayInfo">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
@ -2944,6 +2944,77 @@
|
|||
</node>
|
||||
<node COLOR="#338800" CREATED="1538239665856" ID="ID_518505874" MODIFIED="1538263469675" TEXT="EXPAND">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1538281532767" ID="ID_1335570495" MODIFIED="1538281631433" TEXT="Fehler: muß eigens separate GenNode bauen">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...weil der Payload-Typ für diesen Aufruf bool ist,
|
||||
</p>
|
||||
<p>
|
||||
und nicht string wie für alle anderen state marks
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538281608933" ID="ID_584897977" MODIFIED="1538281622963" TEXT="muß bool parsen...">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1538281635897" ID="ID_562945035" MODIFIED="1538281651821" TEXT="lexical_cast geht nicht">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
k
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="button_cancel"/>
|
||||
<node CREATED="1538281655774" ID="ID_1847834965" MODIFIED="1538281662977" TEXT="kann nur 1 und 0"/>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1538281664349" ID="ID_1454517361" MODIFIED="1538281687765" TEXT="interessanter Folgefehler">
|
||||
<icon BUILTIN="broken-line"/>
|
||||
<node CREATED="1538281691097" ID="ID_1911272932" MODIFIED="1538281757024" TEXT="exception killt ProcDispatcher (das ist OK)">
|
||||
<icon BUILTIN="full-1"/>
|
||||
</node>
|
||||
<node CREATED="1538281708919" ID="ID_1611370738" MODIFIED="1538281759509" TEXT="error state ist gesetzt">
|
||||
<icon BUILTIN="full-2"/>
|
||||
</node>
|
||||
<node CREATED="1538281715646" ID="ID_1541383645" MODIFIED="1538281762796" TEXT="emergency shutdown">
|
||||
<icon BUILTIN="full-3"/>
|
||||
</node>
|
||||
<node CREATED="1538281733340" ID="ID_1326729675" MODIFIED="1538281765434" TEXT="fährt das GUI runter">
|
||||
<icon BUILTIN="full-4"/>
|
||||
</node>
|
||||
<node CREATED="1538281741419" ID="ID_1964821489" MODIFIED="1538281775756">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
ein <b>ZombieCheck</b> spricht an
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="full-5"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1538281782245" ID="ID_888818129" MODIFIED="1538281805087" TEXT="welcher...?">
|
||||
<icon BUILTIN="help"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#fdfdcf" COLOR="#ff0000" CREATED="1538281788117" ID="ID_1747014683" MODIFIED="1538281816152" TEXT="wie konnte das passieren....">
|
||||
<icon BUILTIN="help"/>
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1537835859576" ID="ID_968868056" MODIFIED="1538263469675" TEXT="CLEAR_ERR">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue