...

Source file src/github.com/ory/x/configx/error.go

Documentation: github.com/ory/x/configx

     1  package configx
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/pkg/errors"
     7  )
     8  
     9  type ImmutableError struct {
    10  	From interface{}
    11  	To   interface{}
    12  	Key  string
    13  	error
    14  }
    15  
    16  func NewImmutableError(key string, from, to interface{}) error {
    17  	return &ImmutableError{
    18  		From:  from,
    19  		To:    to,
    20  		Key:   key,
    21  		error: errors.Errorf("immutable configuration key \"%s\" was changed from \"%v\" to \"%v\"", key, from, to),
    22  	}
    23  }
    24  
    25  func (e *ImmutableError) Error() string {
    26  	return fmt.Sprintf("immutable configuration key \"%s\" was changed from \"%v\" to \"%v\"", e.Key, e.From, e.To)
    27  }
    28  

View as plain text