Skip to content

Throw error in console if :on-success and :on-failure not provided in :request effect map#2

Open
pianostringquartet wants to merge 1 commit intooconn:masterfrom
pianostringquartet:require-on-failure-and-on-success
Open

Throw error in console if :on-success and :on-failure not provided in :request effect map#2
pianostringquartet wants to merge 1 commit intooconn:masterfrom
pianostringquartet:require-on-failure-and-on-success

Conversation

@pianostringquartet
Copy link

When we do not provide :on-success or :on-failure, handle-request defaults to :http-no-on-success and :http-no-on-failure.

However, there do not seem to be handlers registered for these, and thus re-frame complains about no :event handler registered for ...:

Screen Shot 2020-10-04 at 8 22 56 PM
(In the screenshot we failed to provide an on-failure handler.)

The consumer of the library will either have to (1) register handlers for those events, or (2) always provide on-success and on-failure.

This PR is a naive attempt to force the user to do (2): we warn (in the console) when on-success and/or on-failure have not been provided.

(Big diff just because of indentation change.)

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.

1 participant