Commit 15c59da
committed
Catch panic when using go-spew
go-spew can panic when trying to diff certain types of values, there are
open issues about this on their GitHub repository.
go-spew is unfortunately unmaintained, we cannot expect a fix any time
soon. Also, because of go-spew's design, there are multiple causes for
a panic, and fixing all of them would be a huge undertaking.
We already return an empty diff when the types are not comparable, or
when the values are not from types that can be easily diffed by go-spew.
Let's hide the panic by recovering from it, and returning an empty diff
instead. This is not ideal, but at least it prevents the entire program from
crashing. The expected/actual values will still be printed, just without
the diff.1 parent 429ee0b commit 15c59da
1 file changed
Lines changed: 25 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1948 | 1948 | | |
1949 | 1949 | | |
1950 | 1950 | | |
1951 | | - | |
1952 | | - | |
1953 | | - | |
1954 | | - | |
1955 | | - | |
1956 | | - | |
1957 | | - | |
1958 | | - | |
1959 | | - | |
1960 | | - | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
1961 | 1970 | | |
1962 | 1971 | | |
1963 | | - | |
| 1972 | + | |
1964 | 1973 | | |
1965 | 1974 | | |
1966 | 1975 | | |
| |||
1970 | 1979 | | |
1971 | 1980 | | |
1972 | 1981 | | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
1973 | 1987 | | |
1974 | 1988 | | |
1975 | 1989 | | |
| |||
0 commit comments