Closed IronCore864 closed 3 months ago
Hi @benhoyt, I'm creating a draft PR, I'm not sure if this is the right way to implement it:
In order to use pebble-service-args
in PlanManager.SetServiceArgs
after making pebble-*
as reserved layer label, the function SetServiceArgs
has to check if the returned err, if the error suggests a reserved label is used, ignore it, because pebble itself should be able to use reserved label, right?
Then I found out Layer.Validate()
currently returns only type FormatError
, in which case, I'd have to check on the error message, something like strings.Contains(err.Error(), "cannot use reserved layer label")
.
But I think in Go it is generally recommended to avoid relying on error messages and it's better to handle errors based on types, right?
So in my draft I created another type ReservedLabelError
, and in SetServiceArgs
I ignore the error if it's this type. Does this make sense?
Making layers with label "pebble-*" reserved for pebble use only.
Closes https://github.com/canonical/pebble/issues/220.
Test: