[webkit-reviews] review granted: [Bug 175603] Add a DOMPromiseDeferred method to handle ExceptionOr<> results : [Attachment 318275] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 17 09:07:37 PDT 2017


Darin Adler <darin at apple.com> has granted youenn fablet <youennf at gmail.com>'s
request for review:
Bug 175603: Add a DOMPromiseDeferred method to handle ExceptionOr<> results
https://bugs.webkit.org/show_bug.cgi?id=175603

Attachment 318275: Patch

https://bugs.webkit.org/attachment.cgi?id=318275&action=review




--- Comment #14 from Darin Adler <darin at apple.com> ---
Comment on attachment 318275
  --> https://bugs.webkit.org/attachment.cgi?id=318275
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=318275&action=review

The "settle" idea is great. I like Chris’s suggestion of using std::optional
instead of a error called "none" and the idea to reduce or remove the Error
enumeration entirely if possible.

> Source/WebCore/Modules/cache/CacheStorageConnection.h:49
> +    static std::optional<Exception> convertErrorIntoException(Error);

std::optional<Exception> and ExceptionOr<void> are nearly identical. We should
not use both. I suggest merging exceptionIfAny and convertErrorIntoException
into a single function; and call it convertErrorIntoException,
convertToException, or exception. Then your exceptionOrResult function, if you
choose to keep it, can just call that. It should be easy and clear to make an
ExceptionOr<T> out of an ExceptionOr<void> rather than also using
std::optional<Exception>.


More information about the webkit-reviews mailing list