add comment

This commit is contained in:
jolestar 2017-07-12 18:33:00 +08:00
parent c122f02485
commit 4ed980d86a
1 changed files with 4 additions and 2 deletions

View File

@ -5,14 +5,16 @@ import (
"time"
)
// An Error represents a timeout error.
// TimeoutError An Error represents a timeout error.
type TimeoutError struct {
timeout time.Duration
}
// Error message
func (e *TimeoutError) Error() string { return fmt.Sprintf("Wait timeout [%s] ", e.timeout) }
// Timeout duration
func (e *TimeoutError) Timeout() time.Duration { return e.timeout }
// NewTimeoutError create a new TimeoutError
func NewTimeoutError(timeout time.Duration) *TimeoutError {
return &TimeoutError{timeout: timeout}
}