warning.go 622 B

1234567891011121314151617181920212223242526
  1. package prom
  2. // warning represents an unexpected result that occurs but doesn't halt processing
  3. type warning interface {
  4. Message() string
  5. }
  6. // defaultWarning is a simple implementation for warning
  7. type defaultWarning struct {
  8. message string
  9. }
  10. // Message returns the message for the warning
  11. func (dw *defaultWarning) Message() string {
  12. return dw.message
  13. }
  14. // Stringer implementation
  15. func (dw *defaultWarning) String() string {
  16. return dw.message
  17. }
  18. // Creates a warning for the prom package. NOTE: We can make this less prom-centric if desirable.
  19. func newWarning(msg string) warning {
  20. return &defaultWarning{msg}
  21. }