Constructs exception object with mutable buffer pre-allocated to length size and other fields kept invalid.
Appends new substring to mutable exception message
Appends an integer to mutable exception message
Throws this instance if ok is false, 0 or null.
Appends formatted string
Sets exception information for this instance.
Fields used instead of msg for mutable messages. Exception.msg has istring type thus can't be overwritten with new data
auto e = new SomeReusableException(100); e.set("message"); test (e.message() == "message"); auto old_ptr = e.reused_msg[].ptr; try { ocean.core.Enforce.enforce(e, false, "immutable"); assert (false); } catch (SomeReusableException) { } test (e.message() == "immutable"); try { e.enforce(false, "longer message"); } catch (SomeReusableException) { } test (e.message() == "longer message"); test (old_ptr is e.reused_msg[].ptr); try { e.badName("NAME", 42); } catch (SomeReusableException) { } test (e.message() == "Wrong name (NAME) 0x2A 42"); test (old_ptr is e.reused_msg[].ptr);
Common code to implement reusable exception semantics - one that has mutable message buffer where message data gets stored to