Skip to content

orThrow — @gj-kit/toss-payments

A public function from @gj-kit/toss-payments/server. The signature below is taken directly from the 0.6.1 release declaration.

import { orThrow } from '@gj-kit/toss-payments/server';
/**
* 유일한 throw 탈출구 — **부팅 시 설정 파싱(키 로드) 전용**.
*
* 요청 처리 경로에서는 사용하지 말 것: 이 라이브러리의 모든 공개 작업은 Result를
* 반환하며, 요청 경로의 실패는 판별자 내로잉(`if (!r.ok)`)으로 다뤄야 한다.
* 메서드가 아닌 자유 함수인 이유: Result 값은 어디서든 plain 객체로 직렬화 안전해야 한다.
*
* @param context - 던지는 Error 메시지 앞에 붙는 식별 문맥 (예: 'TOSS_SECRET_KEY')
* @throws Error - 실패 변형일 때. `cause`에 원본 에러 값을 보존한다.
*/
declare function orThrow<T, E>(r: Result<T, E>, context?: string): T;

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/toss-payments
  • Version: 0.6.1
  • Public entry: ./server
  • Source: GitHub