Q: Exception design questions

Henning Hasemann hhasemann at web.de
Sat Jun 16 05:44:34 PDT 2007


Am Sat, 16 Jun 2007 04:32:02 +0200
schrieb Myron Alexander <someone at somewhere.com>:

> > (new SqlProgrammingException (
> >    "Invalid bind type. Mixing single and multiple value rows. "
> >    "The first argument type is other than Box[], thus it is "
> >    "assumed that the rest of the arguments are single value "
> >    "rows."))
> > .setSql (operation)
> > .setProperty ("ValueRow", i)
> > .setProperty ("ValueType", t)
> > .raise ();

why exactly do you use this pattern? Why not

auto ex = new SqlProgrammingException("text");
with(ex) {
  setSql(operation);
  setProperty("ValueRow", i);
  setProperty("ValueType", t);
}
throw ex;

Ok that are 2 additional lines and a temporary variable but that
shouldnt be a problem, or?

Henning

-- 
GPG Public Key:
http://keyserver.ganneff.de:11371/pks/lookup?op=get&search=0xDDD6D36D41911851
Fingerprint: 344F 4072 F038 BB9E B35D  E6AB DDD6 D36D 4191 1851



More information about the Digitalmars-d mailing list