Add error handling to variable declarations