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
This commit is contained in:
committed by
Facebook Github Bot
parent
d4acdf8504
commit
186af77f62
@@ -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}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user