github.com/juju/juju@v0.0.0-20240327075706-a90865de2538/core/charm/downloader/error.go (about) 1 // Copyright 2021 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package downloader 5 6 import ( 7 "fmt" 8 ) 9 10 type errCharmAlreadyStored struct { 11 charmURL string 12 } 13 14 // Error implements error. 15 func (e errCharmAlreadyStored) Error() string { 16 return fmt.Sprintf("charm %q has already been downloaded", e.charmURL) 17 } 18 19 // NewCharmAlreadyStoredError creates an error that indicates that a charm has 20 // already been stored. 21 func NewCharmAlreadyStoredError(charmURL string) error { 22 return errCharmAlreadyStored{ 23 charmURL: charmURL, 24 } 25 }