Rework frontend callback architecture.

The frontend callback architecture can now handle various
styles of callbacks:
- Exception-style: someResourceMethod(..., function (data) ...)
  If successful, the callback is called, otherwise an exception is
  thrown.
- Node-style: someResourceMethod(..., function (err, data) ...)
  If successful, err is null.
- Split-style: someResourceMethod(..., function (data) ..., function
  (err) ...)
  If successful, first callback is called. Otherwise the second.