Discord: fix voice duration error handling

This commit is contained in:
Shadow 2026-02-13 12:34:59 -06:00 committed by Shadow
parent 1c9c01ff49
commit c87e481ec9
1 changed files with 2 additions and 3 deletions

View File

@ -50,9 +50,8 @@ export async function getAudioDuration(filePath: string): Promise<number> {
}
return Math.round(duration * 100) / 100; // Round to 2 decimal places
} catch (err) {
throw new Error(`Failed to get audio duration: ${err instanceof Error ? err.message : err}`, {
cause: err,
});
const errMessage = err instanceof Error ? err.message : String(err);
throw new Error(`Failed to get audio duration: ${errMessage}`, { cause: err });
}
}