lib/errors: log all handled errors (client as debug, server as error level)