Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 6c00c25

Browse files
author
Melanie Gilman
committed
Return nil when a service doesn't respond to an event
Returning `ok: false` sets `working` to `false` on the service document in the app, which is incorrect when the service isn't being invoked because it isn't defined for the given event type. Returning `nil` makes it easier to distinguish between services that are actually not working and services that are a no-op for a given event.
1 parent 7efc397 commit 6c00c25

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/cc/service.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def receive
8888
end
8989
end
9090

91-
{ ok: false, message: "No service handler found" }
91+
nil
9292
end
9393

9494
private

test/service_test.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ def test_nothing_has_a_handler
2626

2727
result = service.receive
2828

29-
assert_equal false, result[:ok]
30-
assert_equal "No service handler found", result[:message]
29+
assert_nil result
3130
end
3231

3332
def test_post_success

0 commit comments

Comments
 (0)