Remove output generating functions from db layer.

Related to issue #55.

Throw an exception if there is the need to report an error condition instead of writing to somewhere.