Add bindings telemetry (#18851)

* add bindings telemetry

* add exitReasons
This commit is contained in:
Vasu Bhog
2022-03-31 16:29:15 -07:00
committed by GitHub
parent 80db3a492f
commit 0a43ed84e3
6 changed files with 167 additions and 55 deletions

View File

@@ -23,6 +23,8 @@ export interface IPackageInfo {
aiKey: string;
}
export class TimeoutError extends Error { }
/**
* Consolidates on the error message string
*/
@@ -128,7 +130,7 @@ export function generateQuotedFullName(schema: string, objectName: string): stri
export function timeoutPromise(errorMessage: string, ms: number = 10000): Promise<string> {
return new Promise((_, reject) => {
setTimeout(() => {
reject(new Error(errorMessage));
reject(new TimeoutError(errorMessage));
}, ms);
});
}
@@ -173,3 +175,11 @@ export function getPackageInfo(): IPackageInfo {
aiKey: packageJson.aiKey
};
}
export function getErrorType(error: any): string | undefined {
if (error instanceof TimeoutError) {
return 'TimeoutError';
} else {
return 'UnknownError';
}
}