UNPKG

@yuju/tosspayments-sdk

Version:

Toss Payments SDK for Node.js

14 lines (13 loc) 377 B
import { Result } from './result.js'; import { TossPaymentsError } from './tossPaymentsError.js'; export const makeTossPaymentsResult = async (execution) => { try { return Result.Success(await execution()); } catch (error) { if (error instanceof TossPaymentsError) { return Result.Failure(error); } throw error; } };