Discussion:
[capnproto] Custom kj exception error string
David Ondrušek
2018-02-18 10:28:16 UTC
Permalink
Hello, i'm integrating libserialport into my project.

Right now i'm trying to write something similar to KJ_WIN32 and KJ_WINSOCK,
to get the libraries' error messages into the exception description.

Seems like all i have to do is poke makeDescriptionImpl into a public
namespace and copy the code that calls it?
--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+***@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.
Kenton Varda
2018-02-19 19:34:39 UTC
Permalink
Hi David,

Sorry, I'm hesitant to make this interface public, since it's kind of hairy
and I might have to change it in the future.

Your options are:
1) Take a risk and use it despite being private, and just deal with it if
it breaks someday.
2) Copy/paste the whole implementation out of debug.c++ into your own code.
3) Maybe try to implement your custom error macro in terms of
KJ_FAIL_REQUIRE under the hood?

-Kenton

On Sun, Feb 18, 2018 at 2:28 AM, David Ondrušek <
Post by David Ondrušek
Hello, i'm integrating libserialport into my project.
Right now i'm trying to write something similar to KJ_WIN32 and
KJ_WINSOCK, to get the libraries' error messages into the exception
description.
Seems like all i have to do is poke makeDescriptionImpl into a public
namespace and copy the code that calls it?
--
You received this message because you are subscribed to the Google Groups
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/capnproto.
--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+***@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.
David Ondrušek
2018-02-20 18:19:52 UTC
Permalink
KJ_FAIL_REQUIRE seems like a good option, i ended up passing in the
expression and reason along the other VA_ARGS, the output is legible enough.
Post by Kenton Varda
Hi David,
Sorry, I'm hesitant to make this interface public, since it's kind of
hairy and I might have to change it in the future.
1) Take a risk and use it despite being private, and just deal with it if
it breaks someday.
2) Copy/paste the whole implementation out of debug.c++ into your own code.
3) Maybe try to implement your custom error macro in terms of
KJ_FAIL_REQUIRE under the hood?
-Kenton
--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+***@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.
Loading...