Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@kiranshila
Copy link

Fixes #97

Copy link
Member

@JohnnyJayJay JohnnyJayJay left a comment

Choose a reason for hiding this comment

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

Thank you for your PR. In a comment, I have detailed what I think should be adjusted so that this bug/inconsistency is fixed entirely.

~(if delete? `{} `{:body (json/write-str ~opts)})
~(if delete? `(= ~status 204) `(json-body ~body)))))
~(if delete? `(= ~status 204) `(cond->> (json-body ~body)
(not= 2 (quot ~status 100)) (ex-info (str "Attempted to " ~name " with invalid parameters")))))))
Copy link
Member

Choose a reason for hiding this comment

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

This condition ((not= 2 (quot ~status 100))) should really be checked in defdispatch so that it applies to (almost) all dispatch definitions, and not just message updates. The message also should rather be something like
(str "Received an error response from " name " (status " status ")") - there are more reasons for failure than just invalid parameters and the status should be mentioned.

This change requires a bit more effort because:

  • existing ex-info wrappings like in bulk-overwrite-global-application-commands! need to be removed
  • not every dispatch implementation is written using defdispatch, although I think the only separate one to look out for is the send-message! private function.

If you don't have time to make this change, just say the word and I'll make it myself. But as it stands, this only fixes a part of the inconsistency, ideally all of it should be fixed.

Copy link
Author

Choose a reason for hiding this comment

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

Makes sense. Just pushed, I'm giving it a test now.

Copy link
Collaborator

@IGJoshua IGJoshua left a comment

Choose a reason for hiding this comment

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

Sorry to bounce you back and forth on this @kiranshila, wait to update this PR till we get this decided.

@JohnnyJayJay we should consider leaving the call to ex-info as specific to each usage of defendpoint. Many of the endpoints have the value determined as (= status 204) or similar, and those don't have a value to put into an ex-info, which can only take maps, and for these endpoints a non-200 response isn't an error as much as just a negative response.

I think that the original PR updating def-message-dispatch fixes most of the inconsistency, and we should look for specific endpoints that are inconsistent and list them as the ones that need to be fixed, rather than moving it into defendpoint.

@IGJoshua IGJoshua dismissed their stale review January 17, 2022 00:55

leaving it up to johnny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.