Try Catch Block

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2022 Feb 17 16:17
Editor
Edited
Edited
2026 Mar 23 18:43
Refs
Refs
  • Readability is significantly reduced
  • Feels like using GOTO statements due to being disconnected from the main code flow
  • This can lead to duplicate exception handling and difficult maintenance

Go style is better

export async function trycatch<T, E = Error>( promise: Promis<T>, ): Promise<Result<T, E>> { try { const dta = await promise; return { data, error: null } } catch (error) { return { data: null, error: error as E } } }
 
 
 
간단한 모나드 설명과 예제
자바스크립트 관련 코드는 해당 스터디쪽 문서에 올릴 예정. 역시 모나드를 이해할때는 Haskell이 가장 효율적이므로 Haskell로 된 코드를 사용해보자. 자바스크립트로도 설명할 수 있지만(모나드 섹션 하단의 링크 참조) 이해하기에 코드가 깔끔하진 않다. 하스켈의 간단한 입출력 예제다.
간단한 모나드 설명과 예제
 
 

Recommendations