The backtrace code has a parameter that lets you tell it how many
leading frames you want it to skip when generating the result.
This is to get out of the Throwable ctor code itself, but it
wouldn't be hard to bump this by one or two if you need it to.
On Wednesday, 24 December 2014 at 14:11:37 UTC, Adam D. Ruppe
wrote:
auto check(alias func)(int x, string file = __FILE__, size_t
line = __LINE__) {
/* snip */
throw new Exception("%d < 0".format(result), file,
line); // L10
Thanks! I guess that's what my confusion was partially ab
On Wednesday, 24 December 2014 at 14:04:51 UTC, aldanor wrote:
auto check(string file = __FILE__, int line =
__LINE__)(int x) {
You can just do regular params (most the time), don't have to be
template params. My last email shows that too. Then it doesn't
make new templates on each us
On Wednesday, 24 December 2014 at 13:39:00 UTC, aldanor wrote:
(especially when many such functions have been wrapped). Is it
somehow possible to throw an exception "from the parent frame"
so the backtrace would never drop into the template body?
Since this is just passed as arguments to the
"has to generate new parameterized function", of course. sorry.
signature.asc
Description: PGP signature
On Wed, 24 Dec 2014 14:04:50 +
aldanor via Digitalmars-d-learn
wrote:
> On Wednesday, 24 December 2014 at 13:48:26 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > the `object.Exception@wrap.d` is not a backtrace result, this
> > is the
> > result of Exception class constructor:
> >
> > t
On Wednesday, 24 December 2014 at 13:48:26 UTC, ketmar via
Digitalmars-d-learn wrote:
the `object.Exception@wrap.d` is not a backtrace result, this
is the
result of Exception class constructor:
this (string msg, string file=__FILE__, usize line=__LINE__,
Throwable next=null)
it registering
On Wed, 24 Dec 2014 13:38:59 +
aldanor via Digitalmars-d-learn
wrote:
> Imagine there's a template that wraps arbitrary functions and may
> throw exceptions depending on their returned values (see a
> simplified example below). However, if an exception occurs, the
> backtrace is pointing i
Imagine there's a template that wraps arbitrary functions and may
throw exceptions depending on their returned values (see a
simplified example below). However, if an exception occurs, the
backtrace is pointing inside the template which is not helpful at
all (especially when many such functions