Skip to content

Commit

Permalink
🐛 throwError 예제 수정
Browse files Browse the repository at this point in the history
ref #16
  • Loading branch information
sculove committed Sep 29, 2018
1 parent 7c58acc commit 5e32048
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions part2/02.create/create-11.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ <h1>Observable 만들기</h1>
<h2>throwError</h2>
<script>
const { throwError, of } = rxjs;
const { map } = rxjs.operators;
const { mergeMap } = rxjs.operators;

of(1, -2, 3).pipe(
map(number => number < 0 ? throwError("number는 0보다 커야한다") : number)
mergeMap(number => number < 0 ? throwError("number는 0보다 커야한다") : of(number))
)
.subscribe({
next: v => console.log(v),
error: e => console.log(e),
error: e => console.error(e),
complete: () => console.log("완료")
});

// 1
// throwError Observable
// 3
// number는 0보다 커야한다
</script>
</body>
</html>

0 comments on commit 5e32048

Please sign in to comment.