add debug(err) support. Closes #46