lukewagner commented on issue #7383:
@pchickey I think (but may be missing a case), that, with the eager-validation changes Trevor made most recently, there isn't a header-related error that can occur in the constructor?
Independently, the discussion made me think that perhaps (in a post-Preview-2 timeframe) we should relax the C-M
constructor
validation rules to allow constructor functions to return aresult<containing-resource-type, T>
(for anyT
). In languages with EH, this would map to the usual throwing-constructor pattern. Otherwise, bindings would produce their best approximation of a fallible constructor.
pchickey commented on issue #7383:
The function
set: func(name: field-key, value: list<field-value>) -> result<_, header-error>;
allows rejecting input, butconstructor(entries: list<tuple<field-key,field-value>>);
would not allow that same input to be rejected with an error, so currently the implementation traps.
pchickey edited a comment on issue #7383:
The function
set: func(name: field-key, value: list<field-value>) -> result<_, header-error>;
allows rejecting input, butconstructor(entries: list<tuple<field-key,field-value>>);
would not allow that same input to be rejected with an error, so currently the implementation traps.I agree we should allow constructors to throw in a post-p2 timeframe.
lukewagner commented on issue #7383:
Ah, gotcha; I was thinking about the case of passing in the already-constructed
headers
.
Last updated: Nov 22 2024 at 17:03 UTC