Skip to content

fix(cli): classify failures and partial de-panic in the client library - #489

Merged
Harsh4902 merged 3 commits into
microcks:masterfrom
Caesarsage:pr1/classify-errors-and-depanic
Jul 27, 2026
Merged

Harsh4902 merged 3 commits into
microcks:masterfrom
Caesarsage:pr1/classify-errors-and-depanic

Conversation

@Caesarsage

Copy link
Copy Markdown
Collaborator

Part of the Microcks CLI v2 work #255.

Introduces a small Failure Kind vocabulary in pkg/errors (Kind, Wrap/Wrapf, KindOf, and an ErrTestFailed sentinel) and makes the client library return classified errors instead of panicking or exiting.

Why

pkg/connectors and keycloak_client previously panic'd on runtime errors (bad response body, unreachable server). A library that can take down its host process is unsafe to embed, which the planned VS Code extension needs to do. Kinds are the library's vocabulary; exit codes stay a CLI concern (added in next PR ()), so pkg/* never depends on them.

Notable

Fixes two real latent bugs found while de-panicking:

  • Keycloak swallowed request-creation errors: nil-pointer dereference.
  • Unchecked openIDResp["access_token"].(string): the CLI crashed on a Keycloak 401 instead of reporting it.

Scope / safety

Additive and non-breaking: the legacy CheckError/Fatal shim and the existing constructor signatures are untouched here (removed/changed in later PRs). Build + tests green.

@Vaishnav88sk

Copy link
Copy Markdown
Contributor

supersede #481

Comment thread pkg/errors/error_test.go Resolved
Comment thread pkg/connectors/microcks_client.go Resolved
Comment thread pkg/connectors/keycloak_client.go Resolved
Comment thread pkg/connectors/microcks_client.go Resolved
@Vaishnav88sk

Copy link
Copy Markdown
Contributor

DCO is required.

@Caesarsage
Caesarsage force-pushed the pr1/classify-errors-and-depanic branch from c44f139 to f8c27a0 Compare July 23, 2026 08:48
@Caesarsage
Caesarsage force-pushed the pr1/classify-errors-and-depanic branch from f8c27a0 to 732b4ae Compare July 23, 2026 08:57
@Caesarsage

Copy link
Copy Markdown
Collaborator Author

fixed @Vaishnav88sk

@Vaishnav88sk

Copy link
Copy Markdown
Contributor

Suggestion:

@Vaishnav88sk

Copy link
Copy Markdown
Contributor

After that LGTM. 👍🏻

@Caesarsage Caesarsage changed the title fix(cli): classify failures and stop panicking in the client library fix(cli): classify failures and partial de-panic in the client library Jul 23, 2026

@Harsh4902 Harsh4902 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This branch was previously deployed

1 inactive deployment
Build — 732b4ae5 Deployed Jul 23, 2026 by Caesarsage via build-verify-package #611
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/cli kind/task Project maintenance task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants