Skip to content

Commit 7c20ec7

Browse files
authored
CP-52707: Improve Event.from/next API documentation (#6130)
Describe EVENTS_LOST in Event.next. Remove EVENTS_LOST and SESSION_NOT_REGISTERED from Event.from: these are only raised by Event.next. Document the actual errors that Event.from can raise. As requested in #6125 (comment), based on #6125 (comment)
2 parents 7b5dbcb + b93ce07 commit 7c20ec7

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

ocaml/idl/datamodel.ml

+17-5
Original file line numberDiff line numberDiff line change
@@ -8517,11 +8517,18 @@ module Event = struct
85178517
]
85188518
~doc:
85198519
"Blocking call which returns a (possibly empty) batch of events. This \
8520-
method is only recommended for legacy use. New development should use \
8521-
event.from which supersedes this method."
8520+
method is only recommended for legacy use.It stores events in a \
8521+
buffer of limited size, raising EVENTS_LOST if too many events got \
8522+
generated. New development should use event.from which supersedes \
8523+
this method."
85228524
~custom_marshaller:true ~flags:[`Session]
85238525
~result:(Set (Record _event), "A set of events")
8524-
~errs:[Api_errors.session_not_registered; Api_errors.events_lost]
8526+
~errs:
8527+
[
8528+
Api_errors.session_not_registered
8529+
; Api_errors.events_lost
8530+
; Api_errors.event_subscription_parse_failure
8531+
]
85258532
~allowed_roles:_R_ALL ()
85268533

85278534
let from =
@@ -8551,7 +8558,8 @@ module Event = struct
85518558
~doc:
85528559
"Blocking call which returns a new token and a (possibly empty) batch \
85538560
of events. The returned token can be used in subsequent calls to this \
8554-
function."
8561+
function. It eliminates redundant events (e.g. same field updated \
8562+
multiple times)."
85558563
~custom_marshaller:true ~flags:[`Session]
85568564
~result:
85578565
( Set (Record _event)
@@ -8562,7 +8570,11 @@ module Event = struct
85628570
(*In reality the event batch is not a set of records as stated here.
85638571
Due to the difficulty of representing this in the datamodel, the doc is generated manually,
85648572
so ensure the markdown_backend.ml and gen_json.ml is updated if something changes. *)
8565-
~errs:[Api_errors.session_not_registered; Api_errors.events_lost]
8573+
~errs:
8574+
[
8575+
Api_errors.event_from_token_parse_failure
8576+
; Api_errors.event_subscription_parse_failure
8577+
]
85668578
~allowed_roles:_R_ALL ()
85678579

85688580
let get_current_id =

0 commit comments

Comments
 (0)