|
1 | 1 | import { getErrorObject } from '@codebuff/common/util/error' |
2 | 2 |
|
3 | 3 | import { |
| 4 | + markFreebuffSessionCountryBlocked, |
4 | 5 | markFreebuffSessionEnded, |
5 | 6 | markFreebuffSessionSuperseded, |
6 | 7 | refreshFreebuffSession, |
7 | 8 | } from '../use-freebuff-session' |
8 | 9 | import { getProjectRoot } from '../../project-files' |
9 | 10 | import { useChatStore } from '../../state/chat-store' |
| 11 | +import { IS_FREEBUFF } from '../../utils/constants' |
10 | 12 | import { processBashContext } from '../../utils/bash-context-processor' |
11 | 13 | import { markRunningAgentsAsCancelled } from '../../utils/block-operations' |
12 | 14 | import { |
| 15 | + getCountryCodeFromFreeModeError, |
13 | 16 | getFreebuffGateErrorKind, |
14 | 17 | isOutOfCreditsError, |
15 | 18 | isFreeModeUnavailableError, |
@@ -389,6 +392,11 @@ export const handleRunCompletion = (params: { |
389 | 392 |
|
390 | 393 | if (isFreeModeUnavailableError(output)) { |
391 | 394 | updater.setError(FREE_MODE_UNAVAILABLE_MESSAGE) |
| 395 | + if (IS_FREEBUFF) { |
| 396 | + markFreebuffSessionCountryBlocked( |
| 397 | + getCountryCodeFromFreeModeError(output) ?? 'UNKNOWN', |
| 398 | + ) |
| 399 | + } |
392 | 400 | finalizeAfterError() |
393 | 401 | return |
394 | 402 | } |
@@ -484,6 +492,11 @@ export const handleRunError = (params: { |
484 | 492 |
|
485 | 493 | if (isFreeModeUnavailableError(error)) { |
486 | 494 | updater.setError(FREE_MODE_UNAVAILABLE_MESSAGE) |
| 495 | + if (IS_FREEBUFF) { |
| 496 | + markFreebuffSessionCountryBlocked( |
| 497 | + getCountryCodeFromFreeModeError(error) ?? 'UNKNOWN', |
| 498 | + ) |
| 499 | + } |
487 | 500 | return |
488 | 501 | } |
489 | 502 |
|
|
0 commit comments