Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: optimize error message (#14237)

ecmadao817b70ff9db8
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index 4183fed1e4..5dc4754c6b 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -1109,9 +1109,16 @@ func (s *SQLService) accessCheck(
return status.Errorf(codes.Internal, "failed to check access control for database: %q, error %v", column.Database, err)
}
if !ok {
+ resource := attributes["resource.database"]
+ if schema, ok := attributes["resource.schema"]; ok && schema != "" {
+ resource = fmt.Sprintf("%s/schemas/%s", resource, schema)
+ }
+ if table, ok := attributes["resource.table"]; ok && table != "" {
+ resource = fmt.Sprintf("%s/tables/%s", resource, table)
+ }
return status.Errorf(
codes.PermissionDenied,
- "permission denied to access resource: %s", fmt.Sprintf("%s/schemas/%s/tables/%s", attributes["resource.database"], attributes["resource.schema"], attributes["resource.table"]),
+ "permission denied to access resource: %s", resource,
)
}
}