Skip to content

feat(cloud-registry): expose problem details on errors #454

Closed

Description

@uniqueg

Why?

Since cloud-registry 0.4.0, apps must react differently to 401 (log in; e.g., on deployments that require login for reads, elixir-cloud-aai/cloud-registry#168) and 403 (the user lacks a role on the service, elixir-cloud-aai/cloud-registry#62). Users also need the reason for a failed request: the registry explains every error as problem details (title, status, detail, plus serviceId for duplicates), and 400s name the field, e.g. "URLs in 'organization.url' must use one of these schemes: 'http', 'https'."

RestCloudRegistryProvider throws a plain Error with a message built from response.statusText and never reads the body. Apps can't tell the status from it, and statusText is empty over HTTP/2, so the message reads "Failed to create service: ". ecc-service-create-failed passes that message on, so users of the create component don't learn why a registration failed.

The Cloud Registry UI works around this in its own copy of the provider (src/lib/authenticated-cloud-registry.ts): it reads the JSON body, uses detail as the message, and adds status, title, detail and serviceId to the error (elixir-cloud-aai/cloud-registry-ui#5, elixir-cloud-aai/cloud-registry-ui#11).

What?

  • On !response.ok, try response.json() whatever the content type (also application/problem+json; a proxy may send HTML), and use detail (else message) as the error message; fall back to the status if statusText is empty, e.g. "Request failed (400)".
  • Throw an error class, e.g., CloudRegistryError extends Error, with status, title, detail and serviceId, from all provider methods. Export it.
  • Optionally, emit status in the *-failed events of the components (e.g., ecc-service-create-failed), next to error.

Acceptance criteria

  • Apps can tell 401 from 403 (and other statuses) for every provider call.
  • A failed registration in the create component reports the registry's detail.

Notes: highlighting the field named in a 400 inside the create form is tracked in #453.

Activity

  1. added
    priority: medium
    type: feature
    workload: hours
    status: in progress
    and removed on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumstatus: in progresstype: featureworkload: hours

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions