Simply error surfacing

This commit is contained in:
Theodor S. Midtlien
2026-09-25 11:14:34 +02:00
parent ec3a20e979
commit 1939f44bcd
22 changed files with 332 additions and 47 deletions
+2
View File
@@ -26,6 +26,8 @@ func denialCode(reason string) (string, bool) {
return "session_held", true
case ipcauth.ErrorReasonNotProfileOwner:
return "not_profile_owner", true
case ipcauth.ErrorReasonProfileUnowned:
return "profile_unowned", true
default:
return "permission_denied", false
}
+7
View File
@@ -70,6 +70,7 @@ func TestClassifyMapsEveryDaemonReason(t *testing.T) {
{"privilege", ipcauth.PrivilegeError("Claiming a profile requires root.", "sudo netbird profile claim"), "privilege_required", true},
{"session held", ipcauth.SessionHeldError("switching profile"), "session_held", true},
{"not owner", ipcauth.NotOwnerError("reading the profile configuration"), "not_profile_owner", false},
{"unowned", ipcauth.UnownedError("connecting", "default", false), "profile_unowned", true},
} {
t.Run(tc.name, func(t *testing.T) {
got := c.classify(tc.err)
@@ -116,6 +117,12 @@ func TestDenialHeadlinesResolveInTheShippedBundle(t *testing.T) {
"This profile belongs to another user.",
"Reading the profile configuration is refused because the profile it addresses belongs to another user.",
},
{
"unowned",
ipcauth.UnownedError("connecting", "default", false),
"This profile has no owner yet.",
"Connecting is refused because the profile it addresses has no owner on record.",
},
} {
t.Run(tc.name, func(t *testing.T) {
got := c.classify(tc.err)