Exercise - CatchError Operator

Error Handling

Exercise

This is exercise is similar to the previous exercise, so we'll start with the solution to the throwError() operator exercise.

  1. Open exercise on codesandbox.
  2. Remove the truthy/falsey check of the value property values for the email and password input elements.
  3. Within the mergeMap() return the Observable created by the ajax.post() method.
  4. Use the catchError() on the inner Observable returned by the ajax.post() method to catch an HTTP error response. For simplicity, use the console.error() method to log the error to the console. Then, rethrow the error using the throwError() operator.

Exercise - CatchError Operator

Error Handling

Exercise

This is exercise is similar to the previous exercise, so we'll start with the solution to the throwError() operator exercise.

  1. Open exercise on codesandbox.
  2. Remove the truthy/falsey check of the value property values for the email and password input elements.
  3. Within the mergeMap() return the Observable created by the ajax.post() method.
  4. Use the catchError() on the inner Observable returned by the ajax.post() method to catch an HTTP error response. For simplicity, use the console.error() method to log the error to the console. Then, rethrow the error using the throwError() operator.

Copyright

Site © by LiveLoveApp, LLC

We Can Help!

Need help with RxJS in your project?

Hire Us