Moving error handler into dm-common