Unify error handling and status conversion of errors

Add additional test cases around those scenarios