Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2542

Change diagnostics to use string interpolation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Diagnostics

    Description

      Our various diagnostics use a format string plus varargs to build a message. For example

      this.SDE("Some error message: %s", someArgument)
      

      One downside of this approach is that there is no compile time validation of the format string and arguments. So if the the format strings and args don't match, it can lead to unexpected error messages or runtime errors.

      An alternative approach is to use string interpolation:

      this.SDE(s"Some error message: ${someArgument}")
      

      This completely avoids the possibility of format string/var args missmatch.

      We should go through our diagnostic messages and switch to using string interpolation.

      Attachments

        Activity

          People

            Unassigned Unassigned
            slawrence Steve Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: