Simplify returning errors by using goto