database.sql: handle shorturl properly

While creating another shortener that uses the pre_shorten call, I found
that we weren't using the shorturl passed into new_entry. This worked
with the existing post_shorten call, but lost the result for pre_shorten.

Signed-off-by: Jeff Mahoney <jeffm@jeffreymahoney.com>
linkcache: handle missing shorturl after shortener call

We were using a plain string raise call - use a new CodeError exception
instead.

Signed-off-by: Jeff Mahoney <jeffM@jeffreymahoney.com>