move vsl error check to a macro