testify icon indicating copy to clipboard operation
testify copied to clipboard

Fixed `assert.ErrorAs()` error log text

Open albenik opened this issue 2 years ago • 0 comments

Summary

Improve message of assert.ErrorAs()

Changes

  • Replace non-informative message like expected: %!q(**pgconn.PgError=0xc000114050) to the human readable one.
  • Replaced simple output of "%s", err.Error() to "%T(%s)" for better readability.

Motivation

  • First the %!q(**pgconn.PgError=0xc000114050) text is the broken format string
  • Second — even fixed, resulting err.Error() provides not enough information to see what exactly type of error is expected in errors.As and what is provided.

Related issues

Closes #1115

albenik avatar Dec 16 '21 13:12 albenik