Modernise Unknown Exception handler and Exception messages

This commit is contained in:
Fischlurch 2018-04-02 01:48:51 +02:00
parent 21e47e014a
commit 89d93a13e4
88 changed files with 201 additions and 175 deletions

View file

@ -59,8 +59,8 @@ namespace backend {
using lib::Literal;
namespace error = lumiera::error;
using error::LUMIERA_ERROR_STATE;
using error::LUMIERA_ERROR_EXTERNAL;
using error::LERR_(STATE);
using error::LERR_(EXTERNAL);
typedef struct nobug_flag* NoBugFlag;

View file

@ -509,7 +509,7 @@ namespace advice {
{
SelfCheckFailure (Literal failure)
: error::Fatal (string("Failed test: ")+failure
,LUMIERA_ERROR_INDEX_CORRUPTED)
,LERR_(INDEX_CORRUPTED))
{ }
};
}

View file

@ -92,7 +92,7 @@ namespace facade {
{
if (Accessor<FA>::implProxy_)
throw error::State("Attempt to open an already opened Facade interface."
, error::LUMIERA_ERROR_LIFECYCLE);
, error::LERR_(LIFECYCLE));
}
public:

View file

@ -55,7 +55,7 @@ using util::_Fmt;
using proc::ConfigResolver;
using lumiera::query::QueryHandler; ///////TODO preliminary interface defined in config-rules.hpp
using lumiera::query::LUMIERA_ERROR_CAPABILITY_QUERY;
using lumiera::query::LERR_(CAPABILITY_QUERY);
namespace lumiera{

View file

@ -62,7 +62,7 @@ namespace ctrl {
{
if (not instance)
throw error::Logic ("GTK UI is not in running state"
, error::LUMIERA_ERROR_LIFECYCLE);
, error::LERR_(LIFECYCLE));
return *instance;
}

View file

@ -168,7 +168,7 @@ namespace lib {
creator_ = []() -> OBJ*
{
throw error::Fatal("Service not available at this point of the Application Lifecycle"
,error::LUMIERA_ERROR_LIFECYCLE);
,error::LERR_(LIFECYCLE));
};
}

View file

@ -91,12 +91,12 @@ namespace diff{
if (end_of_target())
throw error::State(_Fmt("Unable to %s element %s from target as demanded; "
"no (further) elements in target sequence") % oper % elm
, LUMIERA_ERROR_DIFF_CONFLICT);
, LERR_(DIFF_CONFLICT));
if (*pos_ != elm)
throw error::State(_Fmt("Unable to %s element %s from target as demanded; "
"found element %s on current target position instead")
% oper % elm % *pos_
, LUMIERA_ERROR_DIFF_CONFLICT);
, LERR_(DIFF_CONFLICT));
}
void
@ -105,7 +105,7 @@ namespace diff{
if (end_of_target())
throw error::State(_Fmt("Premature end of target sequence, still expecting element %s; "
"unable to apply diff further.") % elm
, LUMIERA_ERROR_DIFF_CONFLICT);
, LERR_(DIFF_CONFLICT));
}
void
@ -114,7 +114,7 @@ namespace diff{
if (targetPos == orig_.end())
throw error::State(_Fmt("Premature end of sequence; unable to locate "
"element %s in the remainder of the target.") % elm
, LUMIERA_ERROR_DIFF_CONFLICT);
, LERR_(DIFF_CONFLICT));
}

View file

@ -40,6 +40,7 @@
#include <typeinfo>
#include <iostream>
using util::cStr;
using util::isnil;
using std::exception;
@ -51,12 +52,12 @@ namespace lumiera {
* if an exception reaches one of the top-level
* catch clauses.
* @todo to be localised
* @todo develop a framework to set more specific yet friendly messages
*/
inline const string
default_usermsg (Error* exception_obj) noexcept
{
return string("Sorry, Lumiera encountered an internal error. (")
+ util::typeStr(*exception_obj) + ")";
return "Sorry, Lumiera encountered an internal error.";
}
CStr
@ -163,23 +164,59 @@ namespace lumiera {
namespace error
{
namespace error {
namespace {
void install_unexpectedException_handler ()
{
std::set_terminate (lumiera_unexpectedException);
}
LifecycleHook schedule_ (ON_BASIC_INIT, &install_unexpectedException_handler);
void lumiera_unexpectedException () throw()
std::terminate_handler nextHandler = nullptr;
}
void lumiera_unexpectedException () noexcept
{
CCStr is_halted
CStr is_halted
= "### Lumiera halted due to an unexpected Error ###";
std::cerr << "\n" << is_halted << "\n\n";
ERROR (NOBUG_ON, "%s", is_halted);
std::cerr << "\n" << is_halted << "\n\n";
if (CCStr errorstate = lumiera_error ())
try { // -----find-out-about-any-Exceptions--------
auto lastException = std::current_exception();
if (lastException) {
std::rethrow_exception (lastException);
}
} catch(const lumiera::Error& lerr) {
std::cout << "\n+++ Caught Exception " << lerr.getID() << "\n\n";
ERROR (NOBUG_ON, "+++ caught %s\n+++ messg: %s\n+++ descr: %s"
, cStr(util::typeStr(lerr))
, cStr(lerr.getUsermsg())
, cStr(lerr.what())
);
if (not isnil(lerr.rootCause()))
ERROR (NOBUG_ON, "+++ cause: %s",cStr(lerr.rootCause()));
} catch(const std::exception& e) {
ERROR (NOBUG_ON, "Generic Exception: %s", e.what());
std::cout << "+++ Caught Exception \"" << e.what() << "\"\n";
} catch(...) {
ERROR (NOBUG_ON, "FATAL -- unknown exception");
}
if (CStr errorstate = lumiera_error ())
ERROR (NOBUG_ON, "last registered error was....\n%s", errorstate);
std::terminate();
if (nextHandler)
nextHandler();
else
std::abort();
}
void assertion_terminate (const string& location)
{
throw Fatal (location, LUMIERA_ERROR_ASSERTION)
@ -187,17 +224,6 @@ namespace lumiera {
"an internal consistency check.");
}
void install_unexpectedException_handler ()
{
std::set_unexpected (lumiera_unexpectedException);
}
namespace {
LifecycleHook schedule_ (ON_BASIC_INIT, &install_unexpectedException_handler);
}
} // namespace error
} // namespace lumiera

View file

@ -72,7 +72,7 @@
namespace lib {
namespace error = lumiera::error;
using error::LUMIERA_ERROR_INDEX_BOUNDS;
using error::LERR_(INDEX_BOUNDS);
using util::unConst;
@ -495,7 +495,7 @@ namespace lib {
if (!p || index)
throw error::Logic ("Attempt to access element beyond the end of LinkedElements list"
, LUMIERA_ERROR_INDEX_BOUNDS);
, LERR_(INDEX_BOUNDS));
else
return *p;
}

View file

@ -263,7 +263,7 @@ namespace meta {
* do want the pointer itself (and not a pointer to the pointer). We then
* pass the "object" as so called "glvalue" to the `typeid()` function,
* so to get the evaluation of RTTI, when applicable.
* @warning this function does string transformations behind the scenes,
* @warning this function does string transformations behind the scene,
* and thus should not be used in performance critical context. Moreover,
* the returned type string is not necessarily exact and re-parsable.
*/

View file

@ -80,6 +80,8 @@
namespace lib {
namespace error = lumiera::error;
using error::LERR_(BOTTOM_VALUE);
using error::LERR_(WRONG_TYPE);
using util::isSameObject;
using util::unConst;
@ -134,7 +136,7 @@ namespace lib {
return asBase;
throw error::Logic ("Unable to convert concrete object to Base interface"
, error::LUMIERA_ERROR_WRONG_TYPE
, LERR_(WRONG_TYPE)
);
}
};
@ -219,7 +221,7 @@ namespace lib {
getBase() const
{
throw error::Invalid("accessing empty holder"
, error::LUMIERA_ERROR_BOTTOM_VALUE);
, LERR_(BOTTOM_VALUE));
}
virtual void
@ -452,11 +454,11 @@ namespace lib {
if (this->empty())
throw error::Invalid("accessing empty holder"
, error::LUMIERA_ERROR_BOTTOM_VALUE);
,LERR_(BOTTOM_VALUE));
else
throw error::Logic ("Attempt to access OpaqueHolder's contents "
"specifying incompatible target type"
, error::LUMIERA_ERROR_WRONG_TYPE
, LERR_(WRONG_TYPE)
);
}

View file

@ -36,7 +36,7 @@
namespace lib {
using lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE;
using lumiera::error::LERR_(BOTTOM_VALUE);
@ -88,7 +88,7 @@ namespace lib {
{
if (!isValid())
throw lumiera::error::Logic ("access to this object is (not/yet) enabled"
, LUMIERA_ERROR_BOTTOM_VALUE);
, LERR_(BOTTOM_VALUE));
return *ref_;
}

View file

@ -80,8 +80,8 @@
namespace lib {
namespace error = lumiera::error;
using error::LUMIERA_ERROR_CAPACITY;
using error::LUMIERA_ERROR_INDEX_BOUNDS;
using error::LERR_(CAPACITY);
using error::LERR_(INDEX_BOUNDS);
@ -329,7 +329,7 @@ namespace lib {
return elements_[index].accessObj();
throw error::Logic ("Attempt to access not (yet) existing object in ScopedCollection"
, LUMIERA_ERROR_INDEX_BOUNDS);
, LERR_(INDEX_BOUNDS));
}
@ -366,7 +366,7 @@ namespace lib {
{
if (level_ >= capacity_)
throw error::State ("ScopedCollection exceeding the initially defined capacity"
, LUMIERA_ERROR_CAPACITY);
, LERR_(CAPACITY));
}

View file

@ -55,7 +55,7 @@ namespace lib {
namespace fsys = boost::filesystem;
LUMIERA_ERROR_DECLARE (FILE_NOT_DIRECTORY); ///< path element points at a file instead of a directory
using error::LUMIERA_ERROR_ITER_EXHAUST;
using error::LERR_(ITER_EXHAUST);
/** retrieve the location of the executable */
@ -102,7 +102,7 @@ namespace lib {
{
if (!isValid())
throw error::Logic ("Search path exhausted."
,LUMIERA_ERROR_ITER_EXHAUST);
,LERR_(ITER_EXHAUST));
string currentPathElement = pos_->str();
++pos_;

View file

@ -284,13 +284,13 @@ namespace lib {
wait (BF& predicate, Timeout& waitEndTime)
{
bool ok = true;
while (ok && !predicate())
while (ok and !predicate())
if (waitEndTime)
ok = Cond::timedwait (&waitEndTime);
else
ok = Cond::wait ();
if (!ok && lumiera_error_expect(LUMIERA_ERROR_LOCK_TIMEOUT)) return false;
if (not ok and lumiera_error_expect(LUMIERA_ERROR_LOCK_TIMEOUT)) return false;
lumiera::throwOnError(); // any other error throws
return true;

View file

@ -101,7 +101,7 @@ namespace lib {
TAR *p(get());
if (!p)
throw lumiera::error::State ("dereferencing a thread local NULL pointer"
,lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE);
,lumiera::error::LERR_(BOTTOM_VALUE));
return p;
}

View file

@ -77,7 +77,7 @@ namespace time {
return frameGrid.timeOf (lexical_cast<FrameCnt> (match[1]));
else
throw error::Invalid ("unable to parse framecount \""+frameNumber+"\""
, LUMIERA_ERROR_INVALID_TIMECODE);
, LERR_(INVALID_TIMECODE));
}
@ -145,7 +145,7 @@ namespace time {
}
else
throw error::Invalid ("unable to parse \""+seconds+"\" as (fractional)seconds"
, LUMIERA_ERROR_INVALID_TIMECODE);
, LERR_(INVALID_TIMECODE));
}

View file

@ -582,7 +582,7 @@ namespace time {
{
if (n == 0)
throw error::Logic ("Degenerated frame grid not allowed"
, error::LUMIERA_ERROR_BOTTOM_VALUE);
, error::LERR_(BOTTOM_VALUE));
return n;
}
}//(End) implementation helpers

View file

@ -312,7 +312,7 @@ namespace lib {
throw error::Logic("Variant type mismatch: "
"the given variant record does not hold "
"a value of the type requested here"
,error::LUMIERA_ERROR_WRONG_TYPE);
,error::LERR_(WRONG_TYPE));
else
return *buff;
}

View file

@ -58,7 +58,7 @@ namespace wrapper {
using util::unConst;
using util::isSameObject;
using lib::meta::_Fun;
using lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE;
using lumiera::error::LERR_(BOTTOM_VALUE);
using std::function;
@ -272,7 +272,7 @@ namespace wrapper {
{
if (!created_)
throw lumiera::error::State ("accessing uninitialised value/ref wrapper"
, LUMIERA_ERROR_BOTTOM_VALUE);
, LERR_(BOTTOM_VALUE));
return access();
}
@ -339,7 +339,7 @@ namespace wrapper {
{
if (!content_)
throw lumiera::error::State ("accessing uninitialised reference wrapper"
, LUMIERA_ERROR_BOTTOM_VALUE);
, LERR_(BOTTOM_VALUE));
return *content_;
}

View file

@ -242,7 +242,7 @@ namespace asset {
"(multichannel) media. Found parent Media %s.")
% mediaref
% *mediaref.checkCompound()
,LUMIERA_ERROR_PART_OF_COMPOUND);
,LERR_(PART_OF_COMPOUND));
Clip* pC = new Clip (mediaref);
return AssetManager::instance().wrap (*pC);
}

View file

@ -70,7 +70,7 @@ namespace asset {
using util::isnil;
using util::contains;
using lumiera::Query;
using lumiera::query::LUMIERA_ERROR_CAPABILITY_QUERY;
using lumiera::query::LERR_(CAPABILITY_QUERY);
using lib::query::extractID;
using proc::mobject::Session;

View file

@ -70,7 +70,7 @@ namespace asset {
UnknownID (ID<Asset> aID)
: IDErr(_Fmt("Query for Asset with ID=%d, which up to now "
"hasn't been created or encountered.") % aID
,LUMIERA_ERROR_UNKNOWN_ASSET_ID)
,LERR_(UNKNOWN_ASSET_ID))
{ }
};
@ -80,7 +80,7 @@ namespace asset {
: IDErr (_Fmt("Request for Asset(%s), specifying an Asset kind, "
"that doesn't match the actual type (and can't be "
"casted either).") % idi
,LUMIERA_ERROR_WRONG_ASSET_KIND)
,LERR_(WRONG_ASSET_KIND))
{ }
};

View file

@ -80,7 +80,7 @@ namespace control {
{
if (!clo)
throw lumiera::error::State ("Lifecycle error: function arguments not ready",
LUMIERA_ERROR_UNBOUND_ARGUMENTS);
LERR_(UNBOUND_ARGUMENTS));
clo.invoke (func_);
}
@ -138,7 +138,7 @@ namespace control {
{
if (!clo)
throw lumiera::error::State ("need additional function arguments to be able to capture UNDO state",
LUMIERA_ERROR_UNBOUND_ARGUMENTS);
LERR_(UNBOUND_ARGUMENTS));
captureMemento_(clo);
return *this;

View file

@ -76,7 +76,7 @@ namespace control {
if (not cmd.canExec())
throw error::Logic(_Fmt("Reject '%s'. Not suitably prepared for invocation: %s")
% cmd.getID() % cmd
, LUMIERA_ERROR_UNBOUND_ARGUMENTS);
, LERR_(UNBOUND_ARGUMENTS));
lib::IterQueue<Command>::feed (move(cmd));
return *this;

View file

@ -122,7 +122,7 @@ namespace control {
{
if (not definitionBlock)
throw error::Invalid ("unbound function/closure provided for CommandSetup"
, error::LUMIERA_ERROR_BOTTOM_VALUE);
, error::LERR_(BOTTOM_VALUE));
pendingCmdDefinitions().emplace_front (cmdID_, move(definitionBlock));
return *this;
@ -189,7 +189,7 @@ namespace control {
"is currently open for parametrisation and "
"not yet dispatched for execution."}
% instanceID % invocationID
, LUMIERA_ERROR_DUPLICATE_COMMAND
, LERR_(DUPLICATE_COMMAND)
);
// create new clone from the prototype
table_[instanceID] = move (Command::get(prototypeID).newInstance());
@ -219,7 +219,7 @@ namespace control {
if (not entry->second)
throw error::Logic (_Fmt{"Command instance '%s' is not (yet/anymore) active"}
% instanceID
, error::LUMIERA_ERROR_LIFECYCLE);
, error::LERR_(LIFECYCLE));
return entry->second;
}
@ -241,11 +241,11 @@ namespace control {
"globally registered command definition, "
"nor to an previously opened command instance")
% instanceID
, LUMIERA_ERROR_INVALID_COMMAND);
, LERR_(INVALID_COMMAND));
if (not entry->second.isValid())
throw error::Logic (_Fmt{"Command instance '%s' is not (yet/anymore) active"}
% instanceID
, error::LUMIERA_ERROR_LIFECYCLE);
, error::LERR_(LIFECYCLE));
if (not must_be_bound or entry->second.canExec())
instance = move(entry->second);
}
@ -253,7 +253,7 @@ namespace control {
throw error::State (_Fmt{"attempt to dispatch command instance '%s' "
"without binding all arguments properly beforehand"}
% instanceID
, LUMIERA_ERROR_UNBOUND_ARGUMENTS);
, LERR_(UNBOUND_ARGUMENTS));
ENSURE (instance.isValid() and
(instance.canExec() or not must_be_bound));

View file

@ -138,7 +138,7 @@ namespace control {
if (!isValid())
throw lumiera::error::State ("Lifecycle error: can't bind functor, "
"command arguments not yet provided",
LUMIERA_ERROR_UNBOUND_ARGUMENTS);
LERR_(UNBOUND_ARGUMENTS));
arguments_->invoke(func);
}

View file

@ -145,7 +145,7 @@ namespace control {
if (!isValid())
throw lumiera::error::State ("Lifecycle error: can't bind functor, "
"command arguments not yet provided",
LUMIERA_ERROR_UNBOUND_ARGUMENTS);
LERR_(UNBOUND_ARGUMENTS));
arguments_->invoke(func);
}

View file

@ -80,7 +80,7 @@ namespace control {
REQUIRE (handle);
if (!handle->isValid())
throw error::Invalid (operation_descr+" an undefined command"
, LUMIERA_ERROR_INVALID_COMMAND);
, LERR_(INVALID_COMMAND));
}
void
@ -89,7 +89,7 @@ namespace control {
REQUIRE (handle);
if (!handle->canExec())
throw error::State ("Lifecycle error: command arguments not bound"
, LUMIERA_ERROR_UNBOUND_ARGUMENTS);
, LERR_(UNBOUND_ARGUMENTS));
}
void
@ -98,7 +98,7 @@ namespace control {
REQUIRE (handle);
if (!handle->canUndo())
throw error::State ("Lifecycle error: command has not yet captured UNDO information"
, LUMIERA_ERROR_UNBOUND_ARGUMENTS);
, LERR_(UNBOUND_ARGUMENTS));
}
}
@ -129,7 +129,7 @@ namespace control {
Command cmd = CommandRegistry::instance().queryIndex (cmdID);
if (!cmd)
throw error::Invalid(_Fmt("Command \"%s\" not found") % cmdID
, LUMIERA_ERROR_INVALID_COMMAND);
, LERR_(INVALID_COMMAND));
ENSURE (cmdID == CommandRegistry::instance().findDefinition(cmd));
return cmd;
@ -240,7 +240,7 @@ namespace control {
"ID \"%s\" is already in use")
% *this
% newCmdID
, LUMIERA_ERROR_DUPLICATE_COMMAND);
, LERR_(DUPLICATE_COMMAND));
}

View file

@ -178,7 +178,7 @@ namespace control {
{
if (!isCaptured_)
throw lumiera::error::State ("need to invoke memento state capturing beforehand",
LUMIERA_ERROR_MISSING_MEMENTO);
LERR_(MISSING_MEMENTO));
return memento_;
}

View file

@ -126,8 +126,8 @@ namespace engine {
namespace metadata {
using error::LUMIERA_ERROR_LIFECYCLE;
using error::LUMIERA_ERROR_BOTTOM_VALUE;
using error::LERR_(LIFECYCLE);
using error::LERR_(BOTTOM_VALUE);
namespace { // details of hash calculation
template<typename VAL>
@ -242,7 +242,7 @@ namespace engine {
{
if (nontrivial(this->instanceFunc_))
throw error::Logic ("unable to supersede an already attached TypeHandler"
, LUMIERA_ERROR_LIFECYCLE);
, LERR_(LIFECYCLE));
instanceFunc_ = ref.instanceFunc_;
}
@ -399,7 +399,7 @@ namespace engine {
if (NIL == state_)
throw error::Fatal ("Buffer metadata entry with state==NIL encountered."
"State transition logic broken (programming error)"
, LUMIERA_ERROR_LIFECYCLE);
, LERR_(LIFECYCLE));
}
void
@ -409,7 +409,7 @@ namespace engine {
throw error::Logic ("Buffer is inaccessible (marked as free). "
"Need a new buffer pointer in order to lock an entry. "
"You should invoke markLocked(buffer) prior to access."
, LUMIERA_ERROR_LIFECYCLE );
, LERR_(LIFECYCLE));
}
void
@ -417,7 +417,7 @@ namespace engine {
{
if (FREE != state_)
throw error::Logic ("Buffer already in use"
, LUMIERA_ERROR_LIFECYCLE );
, LERR_(LIFECYCLE));
REQUIRE (!buffer_, "Buffer marked as free, "
"but buffer pointer is set.");
}

View file

@ -211,7 +211,7 @@ namespace engine {
REQUIRE (!metaEntry.isTypeKey());
if (!metaEntry.isLocked())
throw error::Logic ("unable to attach an object because buffer isn't locked for use"
, LUMIERA_ERROR_LIFECYCLE);
, LERR_(LIFECYCLE));
metaEntry.useTypeHandlerFrom (refEntry); // EX_STRONG
}
@ -307,8 +307,7 @@ namespace engine {
BuffHandle::takeOwnershipFor(BufferDescriptor const& type)
{
if (!this->isValid())
throw error::Logic ("attaching an object requires an buffer in locked state"
, LUMIERA_ERROR_LIFECYCLE);
throw error::Logic ("attaching an object requires an buffer in locked state", LERR_(LIFECYCLE));
if (this->size() < type.determineBufferSize())
throw error::Logic ("insufficient buffer size to hold an instance of that type");

View file

@ -120,7 +120,7 @@ namespace engine {
{
if (!pBuffer_)
throw error::Logic ("buffer not (yet) locked for access by clients"
, LUMIERA_ERROR_LIFECYCLE);
, LERR_(LIFECYCLE));
return *reinterpret_cast<BU*> (pBuffer_);
}

View file

@ -60,7 +60,7 @@ namespace proc {
namespace engine {
namespace error = lumiera::error;
using error::LUMIERA_ERROR_LIFECYCLE;
using error::LERR_(LIFECYCLE);
using lib::HashVal;

View file

@ -45,7 +45,7 @@ namespace proc {
namespace engine {
namespace error = lumiera::error;
using error::LUMIERA_ERROR_LIFECYCLE;
using error::LERR_(LIFECYCLE);
using lib::HashVal;

View file

@ -109,7 +109,7 @@ namespace mobject {
{
if (!smPtr_)
throw error::State("Lifecycle error: MObject ref not activated"
,LUMIERA_ERROR_BOTTOM_MOBJECTREF);
, LERR_(BOTTOM_MOBJECTREF));
ENSURE (INSTANCEOF (MO, smPtr_.get()));
return smPtr_.operator-> ();
@ -120,7 +120,7 @@ namespace mobject {
{
if (!isValid())
throw error::State("Accessing inactive MObject ref"
,LUMIERA_ERROR_BOTTOM_MOBJECTREF);
, LERR_(BOTTOM_MOBJECTREF));
ENSURE (INSTANCEOF (MO, smPtr_.get()));
return *pRef_;
@ -167,7 +167,7 @@ namespace mobject {
{
if (!isValid())
throw error::State("Attempt to attach a child to an inactive MObject ref"
, LUMIERA_ERROR_BOTTOM_MOBJECTREF);
, LERR_(BOTTOM_MOBJECTREF));
MORef<MOX> newInstance;
PlacementMO::ID thisScope = pRef_;
return newInstance.activate (

View file

@ -218,7 +218,7 @@ namespace mobject {
{
if (not isValid())
throw error::Logic ("attempt to resolve an unconnected output mapping"
, error::LUMIERA_ERROR_UNCONNECTED);
, error::LERR_(UNCONNECTED));
return resolve();
}

View file

@ -271,14 +271,14 @@ namespace proc {
{
if (!placementID)
throw error::Logic ("Attempt to access a NIL PlacementRef"
,LUMIERA_ERROR_BOTTOM_PLACEMENTREF);
, LERR_(BOTTOM_PLACEMENTREF));
Placement<MObject> & genericPlacement (session::SessionServiceFetch::resolveID (placementID)); // may throw
REQUIRE (genericPlacement.isValid());
if (!(genericPlacement.template isCompatible<MX>()))
throw error::Invalid("actual type of the resolved placement is incompatible"
, LUMIERA_ERROR_INVALID_PLACEMENTREF);
, LERR_(INVALID_PLACEMENTREF));
////////////////////////TODO: 1. better message, including type?
////////////////////////TODO: 2. define a separate error-ID for the type mismatch!

View file

@ -515,7 +515,7 @@ namespace session {
if (!contains (targetScope))
throw error::Logic ("Specified a non-registered Placement as scope "
"while adding another Placement to the index"
,LUMIERA_ERROR_INVALID_SCOPE); ////////////////TICKET #197
,LERR_(INVALID_SCOPE)); ////////////////TICKET #197
return pTab_->addEntry(newObj, targetScope);
}

View file

@ -266,7 +266,7 @@ namespace session {
"while the actual type of the pointee (MObject) "
"registered within the index isn't compatible with the "
"requested specific MObject subclass"
,LUMIERA_ERROR_PLACEMENT_TYPE);
, LERR_(PLACEMENT_TYPE));
}
inline void
@ -274,10 +274,10 @@ namespace session {
{
if (!id)
throw lumiera::error::Logic ("Encountered a NIL Placement-ID marker"
,LUMIERA_ERROR_BOTTOM_PLACEMENTREF);
, LERR_(BOTTOM_PLACEMENTREF));
if (!idx.contains (id))
throw lumiera::error::Invalid ("Accessing Placement not registered within the index"
,LUMIERA_ERROR_NOT_IN_SESSION); ///////////////////////TICKET #197
, LERR_(NOT_IN_SESSION)); ///////////////////////TICKET #197
}
}//(End) shortcuts

View file

@ -71,7 +71,7 @@ namespace session {
REQUIRE (path);
if (path->empty())
throw error::Logic (operation_descr+" an empty placement scope path"
, LUMIERA_ERROR_EMPTY_SCOPE_PATH);
, LERR_(EMPTY_SCOPE_PATH));
}
}//(End) helpers
@ -319,7 +319,7 @@ namespace session {
___check_notBottom (this, "Navigating");
if (!target.isValid())
throw error::Invalid ("can't navigate to a target scope outside the model"
, LUMIERA_ERROR_INVALID_SCOPE);
, LERR_(INVALID_SCOPE));
std::vector<Scope> otherPath;
append_all (discoverScopePath(target), otherPath);

View file

@ -215,7 +215,7 @@ namespace session {
{
if (isRoot())
throw lumiera::error::Invalid ("can't get parent of root scope"
, LUMIERA_ERROR_NO_PARENT_SCOPE);
, LERR_(NO_PARENT_SCOPE));
return SessionServiceExploreScope::getScope (*anchor_);
}

View file

@ -58,7 +58,7 @@ namespace session {
// return theGlobalRegistry();
//
// throw error::State ("global model port registry is not accessible"
// , LUMIERA_ERROR_BUILDER_LIFECYCLE);
// , LERR_(BUILDER_LIFECYCLE));
//}

View file

@ -79,7 +79,7 @@ namespace session {
{
ERROR (progress, "Unrecoverable Failure while creating the empty default session.");
throw lumiera::error::Fatal ( "Failure while creating the basic session object. System halted."
, LUMIERA_ERROR_CREATE_SESSION );
, LERR_(CREATE_SESSION));
}

View file

@ -120,7 +120,7 @@ namespace session {
{
if (Scope(placement).isRoot())
throw error::Invalid ("Can't detach the model root."
, LUMIERA_ERROR_INVALID_SCOPE);
, LERR_(INVALID_SCOPE));
QueryFocus currentFocus;
currentFocus.shift (Scope(placement).getParent());

View file

@ -78,7 +78,7 @@ namespace play {
OutputSlot& slot = outputResolver_->getOutputFor (port);
if (!slot.isFree())
throw error::State("unable to acquire a suitable output slot" /////////////////////TICKET #197 #816
, LUMIERA_ERROR_CANT_PLAY);
, LERR_(CANT_PLAY));
return slot;
}

View file

@ -14,7 +14,7 @@ out: intermediate handler caught: LUMIERA_ERROR_EXTERNAL:failure in external ser
out: caught lumiera::Error: LUMIERA_ERROR_STATE:unforeseen state -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-7\).
out: intermediate handler caught: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-8\).....will rethrow as error::State
out: 2nd intermediate handler caught: LUMIERA_ERROR_STATE:unforeseen state -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-8\).....will rethrow as error::Config
out: caught lumiera::Error: LUMIERA_ERROR_CONFIG:misconfiguration -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-8\)\.
out: caught error::Invalid: LUMIERA_ERROR_CONFIG:misconfiguration -- caused by: LUMIERA_ERROR_EXTERNAL:failure in external service \(test-8\)\.
out: caught lumiera::Error: LUMIERA_ERROR_LIFE_AND_UNIVERSE:and everything\? \(what is the answer\?\)\.
out: caught error::Logic: LUMIERA_ERROR_LOGIC:internal logic broken \(the big bang\). -- caused by: LUMIERA_ERROR_LIFE_AND_UNIVERSE:and everything\? \(what is the answer\?\)\.
return: 0

View file

@ -69,7 +69,7 @@ TEST (create_nowrite)
{
lumiera_fileheader header = lumiera_fileheader_create (file, "TEST", 0, sizeof (lumiera_fileheader), NULL);
CHECK(lumiera_error() == LUMIERA_ERROR_FILEHEADER_NOWRITE);
CHECK (lumiera_error() == LUMIERA_ERROR_FILEHEADER_NOWRITE);
lumiera_fileheader_close (&header, LUMIERA_FILEHEADER_FLAG_CLEAN);
}
@ -91,8 +91,8 @@ TEST (acquire_wrongheader)
sizeof (lumiera_fileheader),
LUMIERA_FILEHEADER_FLAG_CLEAN, LUMIERA_FILEHEADER_FLAG_CLEAN);
CHECK(!header.header);
CHECK(lumiera_error() == LUMIERA_ERROR_FILEHEADER_HEADER);
CHECK (!header.header);
CHECK (lumiera_error() == LUMIERA_ERROR_FILEHEADER_HEADER);
lumiera_fileheader_close (&header, LUMIERA_FILEHEADER_FLAG_CLEAN);
}
@ -114,8 +114,8 @@ TEST (acquire_basic)
sizeof (lumiera_fileheader),
LUMIERA_FILEHEADER_FLAG_CLEAN, LUMIERA_FILEHEADER_FLAG_CLEAN);
CHECK(header.header);
CHECK(!lumiera_error());
CHECK (header.header);
CHECK (!lumiera_error());
CHECK (lumiera_fileheader_version (&header) == 0);
@ -141,8 +141,8 @@ TEST (acquire_basic_readonly)
sizeof (lumiera_fileheader),
LUMIERA_FILEHEADER_FLAG_CLEAN, NULL);
CHECK(header.header);
CHECK(!lumiera_error());
CHECK (header.header);
CHECK (!lumiera_error());
CHECK (lumiera_fileheader_version (&header) == 0);

View file

@ -34,7 +34,6 @@ using test::Test;
namespace backend {
namespace test {
using lumiera::error::LUMIERA_ERROR_LOGIC;
namespace {
class TestThread

View file

@ -72,8 +72,8 @@ namespace test{
};
}
using error::LUMIERA_ERROR_LIFECYCLE;
using error::LUMIERA_ERROR_FATAL;
using error::LERR_(LIFECYCLE);
using error::LERR_(FATAL);

View file

@ -56,7 +56,7 @@ namespace test{
} // (End) test setup....
using backend::ThreadJoinable;
using error::LUMIERA_ERROR_LOGIC;
using error::LERR_(LOGIC);
using std::rand;

View file

@ -47,7 +47,7 @@ using std::string;
namespace lib {
namespace test{
using lumiera::error::LUMIERA_ERROR_LIFECYCLE;
using lumiera::error::LERR_(LIFECYCLE);
/**
* Target object to be instantiated as Singleton

View file

@ -34,7 +34,7 @@
#include <cstdlib>
using lumiera::error::LUMIERA_ERROR_ASSERTION;
using lumiera::error::LERR_(ASSERTION);
using util::isSameObject;
using util::typeStr;
using std::rand;

View file

@ -57,7 +57,7 @@ namespace test{
using proc::asset::meta::TimeGrid;
using lib::meta::Types;
using lib::meta::InstantiateChainedCombinations;
using error::LUMIERA_ERROR_UNCONNECTED;
using error::LERR_(UNCONNECTED);

View file

@ -42,7 +42,7 @@ namespace time{
namespace test{
using proc::asset::meta::TimeGrid;
using format::LUMIERA_ERROR_INVALID_TIMECODE;
using format::LERR_(INVALID_TIMECODE);
namespace { // Helper for writing test cases

View file

@ -38,7 +38,7 @@ using boost::lexical_cast;
using util::isnil;
using std::string;
using lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE;
using lumiera::error::LERR_(BOTTOM_VALUE);
namespace lib {
namespace time{

View file

@ -80,8 +80,8 @@ namespace test {
/** marker for simulated failure exceptions */
LUMIERA_ERROR_DEFINE( TEST, "simulated failure.");
using error::LUMIERA_ERROR_LOGIC;
using error::LUMIERA_ERROR_STATE;
using error::LERR_(LOGIC);
using error::LERR_(STATE);
@ -137,7 +137,7 @@ namespace test {
return true;
else
if ("throw"==startSpec) //---starting flounders
throw error::Fatal("simulated failure to start the subsystem", LUMIERA_ERROR_TEST);
throw error::Fatal("simulated failure to start the subsystem", LERR_(TEST));
return started_;
}
@ -200,7 +200,7 @@ namespace test {
if ("true" ==runSpec) termination(0); // signal regular termination
if ("throw"==runSpec)
{
Error problemIndicator("simulated Problem terminating subsystem",LUMIERA_ERROR_TEST);
Error problemIndicator("simulated Problem terminating subsystem",LERR_(TEST));
lumiera_error(); // reset error state....
// Note: in real life this actually
// would be an catched exception!

View file

@ -54,7 +54,7 @@ namespace lib {
namespace idi {
namespace test{
using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
using lumiera::error::LERR_(WRONG_TYPE);
namespace { // Test definitions...

View file

@ -50,7 +50,7 @@ namespace test {
using std::move;
using std::rand;
using lumiera::error::LUMIERA_ERROR_LIFECYCLE;
using lumiera::error::LERR_(LIFECYCLE);

View file

@ -62,7 +62,7 @@ namespace test {
using util::contains;
using lumiera::error::LUMIERA_ERROR_EXTERNAL;
using lumiera::error::LERR_(EXTERNAL);
/** diagnostics: checks if the given value has been written

View file

@ -44,8 +44,8 @@ namespace metadata{
namespace test {
using lumiera::error::LUMIERA_ERROR_INVALID;
using lumiera::error::LUMIERA_ERROR_LIFECYCLE;
using lumiera::error::LERR_(INVALID);
using lumiera::error::LERR_(LIFECYCLE);
namespace { // Test fixture

View file

@ -47,9 +47,9 @@ namespace proc {
namespace engine{
namespace test {
using lumiera::error::LUMIERA_ERROR_FATAL;
using lumiera::error::LUMIERA_ERROR_INVALID;
using lumiera::error::LUMIERA_ERROR_LIFECYCLE;
using lumiera::error::LERR_(FATAL);
using lumiera::error::LERR_(INVALID);
using lumiera::error::LERR_(LIFECYCLE);
namespace { // Test fixture

View file

@ -46,8 +46,8 @@ namespace test {
using lib::test::Dummy;
using proc::engine::BuffHandle;
using error::LUMIERA_ERROR_LOGIC;
using error::LUMIERA_ERROR_LIFECYCLE;
using error::LERR_(LOGIC);
using error::LERR_(LIFECYCLE);
namespace { // Test fixture

View file

@ -42,7 +42,7 @@ namespace test {
using util::isnil;
using util::isSameObject;
using lumiera::error::LUMIERA_ERROR_INVALID;
using lumiera::error::LERR_(INVALID);
/***********************************************************************//**

View file

@ -46,8 +46,8 @@ namespace test {
using util::isnil;
using util::isSameObject;
using lumiera::error::LUMIERA_ERROR_LOGIC;
using lumiera::error::LUMIERA_ERROR_INVALID;
using lumiera::error::LERR_(LOGIC);
using lumiera::error::LERR_(INVALID);

View file

@ -84,7 +84,7 @@ namespace gui {
namespace model{
namespace test {
using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
using lumiera::error::LERR_(WRONG_TYPE);
using ID = lib::idi::BareEntryID const&;
namespace { // test fixture...

View file

@ -50,8 +50,8 @@ namespace gui {
namespace interact {
namespace test {
using lumiera::error::LUMIERA_ERROR_INVALID;
using lumiera::error::LUMIERA_ERROR_STATE;
using lumiera::error::LERR_(INVALID);
using lumiera::error::LERR_(STATE);

View file

@ -45,8 +45,8 @@ namespace gui {
namespace interact {
namespace test {
using lumiera::error::LUMIERA_ERROR_INDEX_BOUNDS;
using lumiera::error::LUMIERA_ERROR_LOGIC;
using lumiera::error::LERR_(INDEX_BOUNDS);
using lumiera::error::LERR_(LOGIC);

View file

@ -52,8 +52,8 @@ namespace lib {
namespace diff{
namespace test{
using error::LUMIERA_ERROR_WRONG_TYPE;
using error::LUMIERA_ERROR_BOTTOM_VALUE;
using error::LERR_(WRONG_TYPE);
using error::LERR_(BOTTOM_VALUE);
namespace {//Test fixture....

View file

@ -47,9 +47,9 @@ namespace lib {
namespace diff{
namespace test{
using lumiera::error::LUMIERA_ERROR_INVALID;
using lumiera::error::LUMIERA_ERROR_INDEX_BOUNDS;
using lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE;
using lumiera::error::LERR_(INVALID);
using lumiera::error::LERR_(INDEX_BOUNDS);
using lumiera::error::LERR_(BOTTOM_VALUE);
namespace {//Test fixture....

View file

@ -37,7 +37,7 @@
#include <string>
#include <vector>
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);
using lib::iter_stl::IterSnapshot;
using lib::iter_stl::snapshot;
using lib::time::Time;

View file

@ -55,7 +55,7 @@ namespace lib {
namespace diff{
namespace test{
using lumiera::error::LUMIERA_ERROR_LOGIC;
using lumiera::error::LERR_(LOGIC);
namespace {//Test fixture....

View file

@ -44,7 +44,7 @@ namespace lib {
namespace test{
using ::Test;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);
using boost::lexical_cast;
using util::for_each;
using util::isnil;

View file

@ -44,7 +44,7 @@ namespace test{
using util::isnil;
using std::vector;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);
namespace { // test fixture

View file

@ -76,7 +76,7 @@ namespace test{
using util::isSameObject;
using lib::iter_stl::eachElm;
using lib::iter_explorer::ChainedIters;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);
using std::string;

View file

@ -39,7 +39,7 @@ namespace test{
using ::Test;
using util::isnil;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);

View file

@ -58,7 +58,7 @@ namespace test{
using std::list;
using std::rand;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);
using iter_source::eachEntry;
using iter_source::transform;

View file

@ -39,7 +39,7 @@ namespace test{
using ::Test;
using util::isnil;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);

View file

@ -80,7 +80,7 @@ namespace test{
using util::isnil;
using util::isSameObject;
using lib::iter_stl::eachElm;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);
using std::vector;
using std::string;

View file

@ -50,7 +50,7 @@ namespace test{
using std::vector;
using std::rand;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);

View file

@ -46,7 +46,7 @@ namespace test{
using util::isnil;
using util::isSameObject;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);
namespace { // test data...
@ -80,7 +80,7 @@ namespace test{
, next(0)
{
if (i == exception_trigger)
throw error::Fatal("simulated error", LUMIERA_ERROR_PROVOKED_FAILURE);
throw error::Fatal("simulated error", LERR_(PROVOKED_FAILURE));
}
};

View file

@ -41,8 +41,8 @@ using std::ostream;
using util::isSameObject;
using lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE;
using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
using lumiera::error::LERR_(BOTTOM_VALUE);
using lumiera::error::LERR_(WRONG_TYPE);
namespace util {

View file

@ -47,7 +47,7 @@ using lib::time::Duration;
using lib::time::Time;
using lib::hash::LuidH;
using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
using lumiera::error::LERR_(WRONG_TYPE);
using std::string;
using std::tuple;

View file

@ -41,8 +41,8 @@ using util::_Fmt;
using util::isnil;
using std::string;
using lumiera::error::LUMIERA_ERROR_LOGIC;
using lumiera::error::LUMIERA_ERROR_WRONG_TYPE;
using lumiera::error::LERR_(LOGIC);
using lumiera::error::LERR_(WRONG_TYPE);
namespace lib {
@ -222,7 +222,7 @@ namespace test {
if (!impl)
throw error::Logic("virtual copy works only on instances "
"of the same concrete implementation class"
,error::LUMIERA_ERROR_WRONG_TYPE);
,error::LERR_(WRONG_TYPE));
else
return *impl;
}

View file

@ -46,7 +46,7 @@ namespace test{
using std::ostream;
using std::string;
using lumiera::error::LUMIERA_ERROR_INVALID;
using lumiera::error::LERR_(INVALID);
namespace { // hierarchy of test dummy objects

View file

@ -43,9 +43,9 @@ namespace test{
using util::isnil;
using util::for_each;
using util::isSameObject;
using error::LUMIERA_ERROR_BOTTOM_VALUE;
using error::LUMIERA_ERROR_WRONG_TYPE;
using error::LUMIERA_ERROR_ASSERTION;
using error::LERR_(BOTTOM_VALUE);
using error::LERR_(WRONG_TYPE);
using error::LERR_(ASSERTION);
using std::vector;
using std::cout;

View file

@ -44,8 +44,8 @@ using util::join;
namespace lib {
namespace test {
using lumiera::error::LUMIERA_ERROR_INDEX_BOUNDS;
using lumiera::error::LUMIERA_ERROR_INVALID;
using lumiera::error::LERR_(INDEX_BOUNDS);
using lumiera::error::LERR_(INVALID);
using ParrT = lib::PathArray<5>;

View file

@ -91,7 +91,7 @@ namespace test{
using util::isnil;
using lumiera::error::LUMIERA_ERROR_ITER_EXHAUST;
using lumiera::error::LERR_(ITER_EXHAUST);
typedef ScopedCollection<Dummy, sizeof(SubDummy)> CollD;