On 2016-12-13 02:18 PM, Neil Hodgson wrote:
> Teodor Petrov:
>
>> I hope you don't intend to make this mandatory.
>> This will make our c++ code really ugly. We'll have to wrap every call of Scintilla in try { ...} catch (...) {} statements.
>> What about using an assert instead or adding a function parameter that decides what to happen with the error?
>
> These 2 lines are what may be added to the Scintilla interface:
>
> typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam, sptr_t *pStatus);
> #define SCI_GETDIRECTFUNCTIONSTATUS 6789
>
Hi Neil,
Would it be possible to also include a strerror()-like facility with
this too? Otherwise each app would have to maintain their own
code->message map if they wanted to provide details to users/callers.
This would make it easier to wrap in a typical C++ stdlib exception or a
GError or such, for example:
::sptr_t ec(0);
SSM(x, m, w, l, &e);
throw std::runtime_error(reinterpret_cast<const char*>(
SSM(x, SCI_GETSTRERROR, ec, 0)));
or:
sptr_t ec=0;
SSM(x, m, w, l, &e);
g_set_error(err, err_quark, ec, "scintilla error: %s",
(const char*) SSM(x, SCI_GETSTRERROR, ec, 0));
Regards,
Matthew Brush