From 186af77f6221d814927c83e1a6ee18788e428c92 Mon Sep 17 00:00:00 2001 From: John Knox Date: Thu, 5 Dec 2019 05:35:35 -0800 Subject: [PATCH] Add error logging to client Id construction Summary: Just in case anything is broken, this will be helpful Reviewed By: nikoant Differential Revision: D18811849 fbshipit-source-id: 53947102dea38e526b4f565396f85fedf4ff2a15 --- src/utils/clientUtils.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/clientUtils.tsx b/src/utils/clientUtils.tsx index 04b7b85d6..5f971af55 100644 --- a/src/utils/clientUtils.tsx +++ b/src/utils/clientUtils.tsx @@ -10,7 +10,7 @@ import Client from '../Client'; import BaseDevice from '../devices/BaseDevice'; -type ClientIdConstituents = { +export type ClientIdConstituents = { app: string; os: string; device: string; @@ -40,6 +40,15 @@ export function buildClientId(clientInfo: { device: string; device_id: string; }): string { + for (const key of ['app', 'os', 'device', 'device_id'] as Array< + keyof ClientIdConstituents + >) { + if (!clientInfo[key]) { + console.error( + `Attempted to build clientId with invalid ${key}: "${clientInfo[key]}`, + ); + } + } return `${clientInfo.app}#${clientInfo.os}#${clientInfo.device}#${clientInfo.device_id}`; }