Uploaded image for project: 'VOLTHA'
  1. VOLTHA
  2. VOL-4416

Implement best practice of wrapping errors when "trapping" and "re-throwing" error

    XMLWordPrintable

    Details

    • Story Points:
      8

      Description

      In go version 1.13, error wrapping/unwrapping was introduced. Since then it has become a best practice to wrap an error when a function catches and error and passes it on.

       

      Ex:

       

      result, err := pkg.SomeFunction()
      if err != nil {
          return err
      }
      

       

       

      becomes something like

       

      result, err := pkg.SomeFunction()
      if err != nil {
          return fmt.Errorf("added context: %w", err)
      }
      

       

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            dbainbri David Bainbridge
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes