github.com/masterhung0112/hk_server/v5@v5.0.0-20220302090640-ec71aef15e1c/services/remotecluster/error.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See LICENSE.txt for license information.
     3  
     4  package remotecluster
     5  
     6  import "fmt"
     7  
     8  type BufferFullError struct {
     9  	capacity int
    10  }
    11  
    12  func NewBufferFullError(capacity int) BufferFullError {
    13  	return BufferFullError{
    14  		capacity: capacity,
    15  	}
    16  }
    17  
    18  func (e BufferFullError) Capacity() int {
    19  	return e.capacity
    20  }
    21  
    22  func (e BufferFullError) Error() string {
    23  	return fmt.Sprintf("buffer capacity (%d) exceeded", e.capacity)
    24  }