API: remove unused imports

Signed-off-by: Jan Dvořák <mordae@anilinux.org>
convert database exceptions

Signed-off-by: Jan Dvořák <mordae@anilinux.org>