Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
return cacheResult(
resolver.resolveDependency(
fromModule,
toModuleName,
allowHaste,
platform,
),
);
} catch (error) {
if (error instanceof DuplicateHasteCandidatesError) {
throw new AmbiguousModuleResolutionError(fromModule.path, error);
}
if (error instanceof InvalidPackageError) {
throw new PackageResolutionError({
packageError: error,
originModulePath: fromModule.path,
targetModuleName: toModuleName,
});
}
throw error;
}
}