(apiClient: CliApiClient, authorizationCode: string)
| 291 | } |
| 292 | |
| 293 | async function getPersonalAccessToken(apiClient: CliApiClient, authorizationCode: string) { |
| 294 | return await tracer.startActiveSpan("getPersonalAccessToken", async (span) => { |
| 295 | try { |
| 296 | const token = await apiClient.getPersonalAccessToken(authorizationCode); |
| 297 | |
| 298 | if (!token.success) { |
| 299 | throw new AbortError(token.error); |
| 300 | } |
| 301 | |
| 302 | if (!token.data.token) { |
| 303 | throw new Error("No token found yet"); |
| 304 | } |
| 305 | |
| 306 | span.end(); |
| 307 | |
| 308 | return { |
| 309 | token: token.data.token.token, |
| 310 | obfuscatedToken: token.data.token.obfuscatedToken, |
| 311 | }; |
| 312 | } catch (e) { |
| 313 | if (e instanceof AbortError) { |
| 314 | recordSpanException(span, e); |
| 315 | } |
| 316 | |
| 317 | span.end(); |
| 318 | |
| 319 | throw e; |
| 320 | } |
| 321 | }); |
| 322 | } |
| 323 | |
| 324 | async function createAuthorizationCode(apiClient: CliApiClient) { |
| 325 | return await tracer.startActiveSpan("createAuthorizationCode", async (span) => { |
no test coverage detected
searching dependent graphs…