mirror of
https://github.com/logos-storage/logos-storage-js.git
synced 2026-01-02 13:33:07 +00:00
14 lines
272 B
TypeScript
14 lines
272 B
TypeScript
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;
|
|
},
|
|
};
|