Skip to content

Commit c2440d4

Browse files
Sayan-cursoragent
andcommitted
step 4: simplify Delete to a single attempt
After dropping the persistent-id fallback there's only one possible error, so the nonNotFoundErrors slice was just noise. Collapse to a direct check. Part of EOL persistent browsers (KERNEL-1015). Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent b87a3f9 commit c2440d4

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

‎cmd/browsers.go‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -465,18 +465,9 @@ func buildBrowserTableData(sessionID, cdpURL, liveViewURL string, profile kernel
465465

466466
func (b BrowsersCmd) Delete(ctx context.Context, in BrowsersDeleteInput) error {
467467
// Treat not found as a success (idempotent delete)
468-
var nonNotFoundErrors []error
469-
470-
if err := b.browsers.DeleteByID(ctx, in.Identifier); err != nil {
471-
if !util.IsNotFound(err) {
472-
nonNotFoundErrors = append(nonNotFoundErrors, err)
473-
}
474-
}
475-
476-
if len(nonNotFoundErrors) > 0 {
477-
return util.CleanedUpSdkError{Err: nonNotFoundErrors[0]}
468+
if err := b.browsers.DeleteByID(ctx, in.Identifier); err != nil && !util.IsNotFound(err) {
469+
return util.CleanedUpSdkError{Err: err}
478470
}
479-
480471
pterm.Success.Printf("Successfully deleted (or already absent) browser: %s\n", in.Identifier)
481472
return nil
482473
}

0 commit comments

Comments
 (0)