Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Precondition failed" should provide more info #1133

Open
htgoebel opened this issue Jan 3, 2021 · 5 comments
Open

"Precondition failed" should provide more info #1133

htgoebel opened this issue Jan 3, 2021 · 5 comments
Labels
adjustment adjustment of option/code/feature need:support support/help/contribution is required prio:medium medium priority
Milestone

Comments

@htgoebel
Copy link

htgoebel commented Jan 3, 2021

I just spent more then one hour tracking down a "Precondition failed" issue. The cause tracked down to "Creation asked but item found: item can't be replaced".

Expected behaviour

If "Precondition failed",

  • report the exact reason to the logger (I suggest using level warning)
  • depending on the security level/policy of this project:
    • report the exact reason in the message body returned
    • report a message without too much details in the message body returned
@pbiering pbiering added prio:medium medium priority adjustment adjustment of option/code/feature labels Nov 27, 2024
@pbiering pbiering added this to the 3.3.x milestone Nov 27, 2024
@pbiering
Copy link
Collaborator

Makes sense, will add some log statements

@pbiering pbiering modified the milestones: 3.3.x, 3.3.3 Dec 24, 2024
@pbiering pbiering added need:reporter feedback feedback from reporter required need:support support/help/contribution is required labels Dec 24, 2024
@pbiering
Copy link
Collaborator

@htgoebel - log statements added, but what is expected as error message (content/format)? Is a client able to display it?

@pbiering pbiering removed need:reporter feedback feedback from reporter required need:support support/help/contribution is required labels Dec 27, 2024
@pbiering
Copy link
Collaborator

closing now as implemented in log and unclear how to display error message to client in which format. As support is needed for the 2nd one has to create a PR in case.

@htgoebel
Copy link
Author

htgoebel commented Jan 2, 2025

Thanks for fixing.

but what is expected as error message (content/format)?

Instead of returning httputils.PRECONDITION_FAILED, one could return something like

types.WSGIResponse = (
    client.PRECONDITION_FAILED,
    (("Content-Type", "text/plain"),), f"Precondition failed: {error_details}")```

If you like the idea, I will provide a pull-request which implements a wrapper creating the response (depending on whether there error_details are given.

Is a client able to display it?

Clients would show it in the error log at least.

@pbiering pbiering modified the milestones: 3.3.3, 3.4.0 Jan 3, 2025
@pbiering
Copy link
Collaborator

pbiering commented Jan 3, 2025

PR is welcome, question is what should be disclosed?

Case 1
Precondition failed on PUT request for %r (HTTP_IF_MATCH: %s, item not existing) -> something like item not exist but requested to update?

Case 2
Precondition failed on PUT request for %r (HTTP_IF_MATCH: %s, item has different etag: %s) -> ??? the item IDs are not really helpful to the user, has then anyhow contact server admin to lookup the item

Case 3
Precondition failed on PUT request for %r (HTTP_IF_NONE_MATCH: *, creation requested but item found with etag: %s) -> something like item already found?

Anyhow, user can only resync collection and try to update then what is still existing.

@pbiering pbiering reopened this Jan 3, 2025
@pbiering pbiering modified the milestones: 3.4.0, 3.4.x Jan 9, 2025
@pbiering pbiering added the need:support support/help/contribution is required label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adjustment adjustment of option/code/feature need:support support/help/contribution is required prio:medium medium priority
Projects
None yet
Development

No branches or pull requests

2 participants