បង្ហាញ​តែ
0:02
S… Speaker 2 (270. Using the catchError Operator)
No matter how you handle your error,
0:04
S… Speaker 2 (270. Using the catchError Operator)
what can be useful is a special operator that can
0:08
S… Speaker 2 (270. Using the catchError Operator)
assist you with handling errors.
0:10
S… Speaker 2 (270. Using the catchError Operator)
And that special operator needs to be imported from rxjs
0:14
S… Speaker 2 (270. Using the catchError Operator)
operators and it's named catch error and it does exactly what the
0:18
S… Speaker 2 (270. Using the catchError Operator)
name suggests.
0:19
S… Speaker 2 (270. Using the catchError Operator)
Now let's say here,
0:21
S… Speaker 2 (270. Using the catchError Operator)
when we fetch posts where we already pipe some data,
0:25
S… Speaker 2 (270. Using the catchError Operator)
we got an error and we want to handle
0:29
S… Speaker 1 (270. Using the catchError Operator)
that.
0:30
S… Speaker 2 (270. Using the catchError Operator)
Now we can simply add the catch error operator here.
0:34
S… Speaker 2 (270. Using the catchError Operator)
We get our error response in here.
0:36
S… Speaker 2 (270. Using the catchError Operator)
So we get exactly the same data we would get
0:40
S… Speaker 2 (270. Using the catchError Operator)
in that second argument of the subscribe method.
0:45
S… Speaker 2 (270. Using the catchError Operator)
And in here,
0:46
S… Speaker 2 (270. Using the catchError Operator)
you could now do stuff like send to analytics server
0:50
S… Speaker 2 (270. Using the catchError Operator)
or anything like that.
0:51
S… Speaker 2 (270. Using the catchError Operator)
So some generic error handling task you might wanna do.
0:54
S… Speaker 2 (270. Using the catchError Operator)
Maybe not related to the UI.
0:57
S… Speaker 2 (270. Using the catchError Operator)
Though of course you could use the subject and next the error message
1:01
S… Speaker 1 (270. Using the catchError Operator)
here too.
1:01
S… Speaker 2 (270. Using the catchError Operator)
But maybe you have some behind the scenes stuff you want to do when an error occurs.
1:06
S… Speaker 2 (270. Using the catchError Operator)
Log it somewhere,
1:07
S… Speaker 2 (270. Using the catchError Operator)
send it to your own server,
1:08
S… Speaker 2 (270. Using the catchError Operator)
your analytics server,
1:10
S… Speaker 2 (270. Using the catchError Operator)
anything like that.
1:11
S… Speaker 2 (270. Using the catchError Operator)
And once you're done handling that error,
1:13
S… Speaker 2 (270. Using the catchError Operator)
you should pass it on though.
1:15
S… Speaker 2 (270. Using the catchError Operator)
It definitely needs to be able to reach subscribe.
1:18
S… Speaker 2 (270. Using the catchError Operator)
Just as you need to pass something here in map as well.
1:21
S… Speaker 2 (270. Using the catchError Operator)
So we also now need to create a new
1:25
S… Speaker 2 (270. Using the catchError Operator)
observable that wraps that error.
1:27
S… Speaker 2 (270. Using the catchError Operator)
And for that,
1:28
S… Speaker 2 (270. Using the catchError Operator)
you can import something from RxJS and that something is throw
1:33
S… Speaker 1 (270. Using the catchError Operator)
error.
1:33
S… Speaker 2 (270. Using the catchError Operator)
And that is a function that will yield a new observable and
1:37
S… Speaker 2 (270. Using the catchError Operator)
it yields a new observable by wrapping an error.
1:41
S… Speaker 2 (270. Using the catchError Operator)
So here we can now throw the...
1:45
S… Speaker 2 (270. Using the catchError Operator)
Error response,
1:46
S… Speaker 2 (270. Using the catchError Operator)
you could also throw a new custom error which you generated whatever
1:50
S… Speaker 1 (270. Using the catchError Operator)
you want.
1:52
S… Speaker 1 (270. Using the catchError Operator)
Important,
1:53
S… Speaker 2 (270. Using the catchError Operator)
you need to return that observable which is created by throw
1:57
S… Speaker 1 (270. Using the catchError Operator)
error.
1:57
S… Speaker 2 (270. Using the catchError Operator)
And now with that,
1:59
S… Speaker 2 (270. Using the catchError Operator)
this of course doesn't do anything useful here,
2:01
S… Speaker 2 (270. Using the catchError Operator)
but it's just an idea that you could consider using catch
2:06
S… Speaker 2 (270. Using the catchError Operator)
error if you have some generic error handling task you also
2:10
S… Speaker 2 (270. Using the catchError Operator)
wanna execute.

អត្ថបទ​នេះ​ត្រូវ​បាន​បង្កើត​ដោយ AI (ការ​ទទួល​ស្គាល់​ការ​និយាយ​ស្វ័យប្រវត្តិ) & # 160; ។ វា​អាច​មាន​កំហុស - ពិនិត្យ​មើល​អូឌីយ៉ូ​ដើម​សម្រាប់​ការ​ប្រើ​សំខាន់ & # 160; ។ គោលការណ៍ AI

❤️ ស្រឡាញ់ STT.ai? ប្រាប់មិត្តភក្តិរបស់អ្នក!
សេចក្ដី​សង្ខេប
ចុច សង្ខេប ដើម្បី​បង្កើត​សេចក្ដី​សង្ខេប AI នៃ​ការ​បកប្រែ​នេះ & # 160; ។
កំពុង​សង្ខេប...
សំណួរ AI អំពី​ការ​បកប្រែ​នេះ
សំណួរអ្វីមួយអំពីការបកប្រែនេះ - AI នឹងរកឃើញផ្នែកដែលទាក់ទងនិងឆ្លើយតប។