Providing user-defined error types

In the previous chapters, we learned about a few ways to handle functions that have to deal with different kinds of errors. So far, we have:

  • Simply panicked when encountering them
  • Returned only one kind of error and converted all others into it
  • Returned different kinds of errors in a Box

Most of these have been used because we didn't reach this recipe yet. Now, we are going to learn about the preferred way of doing things, creating a custom kind of Error that contains multiple sub-errors.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.194.230