14 lines
272 B
TypeScript
Raw Normal View History

2025-05-30 16:55:33 +02:00
import type { SafeValue } from "../values/values";
export const Throwable = {
async from<T>(safePromise: Promise<SafeValue<T>>): Promise<T> {
const result = await safePromise;
if (result.error) {
throw result.data;
}
return result.data;
},
};