github.com/djordje200179/extendedlibrary/datastructures@v1.7.1-0.20240227175559-d09520a92dd4/maps/errors.go (about) 1 package maps 2 3 import "fmt" 4 5 // MissingKeyError is an error that is panicked when trying 6 // to access a key that is missing from a map. 7 type MissingKeyError[K any] struct { 8 Key K // the key that was missing 9 } 10 11 // Error returns the error message. 12 func (err MissingKeyError[K]) Error() string { 13 return fmt.Sprintf("key %v is missing from map", err.Key) 14 }