-
-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Description
Developer experience request
Currently, if dataLoader.getItem() returns a null or undefined value, the message to the user is:
errors.js:2 Uncaught Error: Headless Tree: sync dataLoader returned promise
at throwError (errors.js:2:40)
at unpromise (feature.js:15:15)
at retrieveItemData (feature.js:31:20)
Code for unpromise is located here.
Perhaps that can be changed to...
const undefErrorMessage = "sync dataLoader failed to return data value";
const promiseErrorMessage = "sync dataLoader returned promise";
const unpromise = <T>(data: T | Promise<T>): T => {
if (!data) {
throw throwError(undefErrorMessage);
}
if (typeof data === "object" && "then" in data) {
throw throwError(promiseErrorMessage);
}
return data;
};Metadata
Metadata
Assignees
Labels
No labels