Skip to content

Commit b3f7d2c

Browse files
authored
fix pftools auth error (#58)
1 parent a86d6f8 commit b3f7d2c

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ tmp/
99
# Go
1010
vendor
1111
.cursor/
12-
agents/
12+
agents/
13+
.serena/

pkg/mcp/pftools/errors.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@ func IsClusterUnhealthy(err error) bool {
1919
}
2020
return false
2121
}
22+
23+
func IsAuthError(err error) bool {
24+
if restErr, ok := err.(rest.Error); ok {
25+
return restErr.Code == 403
26+
}
27+
return false
28+
}

pkg/mcp/pftools/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (m *PulsarFunctionManager) updateFunctions() {
157157
log.Printf("Failed to get functions list: %v", err)
158158

159159
// Check if this is a cluster health error and invoke callback if configured
160-
if IsClusterUnhealthy(err) && m.clusterErrorHandler != nil {
160+
if (IsClusterUnhealthy(err) || IsAuthError(err)) && m.clusterErrorHandler != nil {
161161
go m.clusterErrorHandler(m, err)
162162
}
163163
return

0 commit comments

Comments
 (0)