fix error string representation for errors without a message

This commit is contained in:
Marten Seemann
2019-03-07 09:53:13 +09:00
parent 7bd9844d38
commit ab47ba1021
2 changed files with 18 additions and 5 deletions

View File

@@ -31,6 +31,9 @@ func TimeoutError(errorMessage string) *QuicError {
}
func (e *QuicError) Error() string {
if len(e.ErrorMessage) == 0 {
return e.ErrorCode.String()
}
return fmt.Sprintf("%s: %s", e.ErrorCode.String(), e.ErrorMessage)
}