ConnectException.from constructor
Convert any value - typically a caught exception into a ConnectException, following these rules:
- If the value is already a ConnectError, return it as is.
- For other values, return the values String representation as a message, with the code Unknown by default.
Implementation
factory ConnectException.from(Object reason, [Code code = Code.unknown]) {
if (reason is ConnectException) {
return reason;
}
return ConnectException(code, reason.toString(), cause: reason);
}