Return the error message from an error object or array (typically
caught by a catch ). The type of the error is checked, hence
err is declared as mixed
and not object|array
.
If an error message couldn't be obtained, a fallback message
describing the failure is returned. No errors due to incorrectness
in err are thrown.