Revert "use simpler error handling"

This reverts commit a31891fa39a9fc79a2f95be0691a917163e9cbba.
use external throw module for exception raising

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