-
-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Labels
Description
Describe the feature
No big deal, but I would prefer it.
Current
const orpcClient = ...
const orpcClientSafe = ...
const result = await orpcClientSafe.demoPost.getAllPosts();
// or
const result = await safe(orpcClient.demoPost.getAllPosts());
if (!result.isSuccess) {
if (result.isDefined && result.error.code === 'POST_NOT_FOUND') {
// handle this case
}
// rethrow the error if unknown
throw result.error;
}
const post = result.data.data.post;Request
const orpcClient = ...
const orpcClientSafe = ...
const result = await orpcClientSafe.demoPost.getAllPosts();
// or
const result = await safe(orpcClient.demoPost.getAllPosts());
if (!result.isSuccess) {
// 👇
if (result.isDefinedError && result.error.code === 'POST_NOT_FOUND') {
// handle this case
}
// rethrow the error if unknown
throw result.error;
}
const post = result.data.data.post;Additional information
- Would you be willing to help implement this feature?