Skip to content

Commit 48ded16

Browse files
chore: clean duplicated Error thrown
1 parent ef02bd4 commit 48ded16

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

packages/nuxt/src/vite/utils.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,23 @@ export async function findDefaultSdkInitFile(
3737

3838
if (type === 'server') {
3939
if (options?.serverConfigFile) {
40-
try {
41-
const resolvedPath = await resolvePath(options.serverConfigFile);
42-
if (fs.existsSync(resolvedPath)) {
43-
return resolvedPath;
44-
}
45-
throw new Error(`Server configuration file not found: ${resolvedPath}`);
46-
} catch (e) {
47-
throw new Error(`Error resolving server configuration file: ${options.serverConfigFile}. Cause: ${e}`);
40+
const resolvedPath = await resolvePath(options.serverConfigFile);
41+
if (fs.existsSync(resolvedPath)) {
42+
return resolvedPath;
4843
}
44+
throw new Error(`Server configuration file not found: ${resolvedPath}`);
4945
}
5046
for (const ext of possibleFileExtensions) {
5147
relativePaths.push(`sentry.${type}.config.${ext}`);
5248
relativePaths.push(path.join('public', `instrument.${type}.${ext}`));
5349
}
5450
} else {
5551
if (options?.clientConfigFile) {
56-
try {
57-
const resolvedPath = await resolvePath(options.clientConfigFile);
58-
if (fs.existsSync(resolvedPath)) {
59-
return resolvedPath;
60-
}
61-
throw new Error(`Client configuration file not found: ${resolvedPath}`);
62-
} catch (e) {
63-
throw new Error(`Error resolving client configuration file: ${options.clientConfigFile}. Cause: ${e}`);
52+
const resolvedPath = await resolvePath(options.clientConfigFile);
53+
if (fs.existsSync(resolvedPath)) {
54+
return resolvedPath;
6455
}
56+
throw new Error(`Client configuration file not found: ${resolvedPath}`);
6557
}
6658
for (const ext of possibleFileExtensions) {
6759
relativePaths.push(`sentry.${type}.config.${ext}`);

0 commit comments

Comments
 (0)