mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
platformService tests and move tests from tdd to bdd (#13131)
This commit is contained in:
@@ -53,3 +53,12 @@ export function throwUnless(condition: boolean, message?: string): asserts condi
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
export async function tryExecuteAction<T>(action: () => T | PromiseLike<T>): Promise<{ result: T | undefined, error: any }> {
|
||||
let error: any, result: T | undefined;
|
||||
try {
|
||||
result = await action();
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
return { result, error };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user