Check if error non-null before wrapping