Skip to content

Using byName on DataLakeMeasureResource via the Client API throws an exception instead of returning an Optional #4727

Description

@JHoelli

Apache StreamPipes version

dev (current development state)

Affected StreamPipes components

Backend

What happened?

Using byName on DataLakeMeasureResource via the Client API throws an exception instead of returning an Optional, if the name does not already exist. Return 403, Forbidden in such cases makes sense as the resource does not yet exist. However, this should not result in an exception.

When calling getByDatasetName(String datasetName), the method signature suggests that missing or inaccessible resources are represented as Optional.empty(). In practice, this is only true for 404 Not Found.
If the backend responds with 403 Forbidden, the client throws a SpHttpErrorStatusCode instead of returning an Optional. This makes the behavior surprising for client code that expects the result to be modeled consistently through Optional.

How to reproduce?

No response

Expected behavior

No response

Additional technical information

No response

Are you willing to submit a PR?

None

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions