This is in preperation for dynamic import (#1789), which is more easily implemented when errors are dynamic.