Skip to content

Commit

Permalink
Merge pull request #4231 from snyk/chore/HMMR-614_analytics_exception…
Browse files Browse the repository at this point in the history
…_handling

chore: wrap osName() in try-catch
  • Loading branch information
PeterSchafer committed Dec 5, 2022
2 parents d9151b6 + ead1824 commit f6d7eb2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/analytics/getStandardData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ export async function getStandardData(
const durationMs = Date.now() - START_TIME;
const metrics = getMetrics(durationMs);

let osNameString;
try {
osNameString = osName(os.platform(), os.release());
} catch (e) {
osNameString = 'unknown';
}

const data = {
os: osName(os.platform(), os.release()),
os: osNameString,
osPlatform: os.platform(),
osRelease: os.release(),
osArch: os.arch(),
Expand Down

0 comments on commit f6d7eb2

Please sign in to comment.