Add error catching for dynamic origin checking