Skip to content

Commit 4d757d0

Browse files
committed
fix: remote config manager error handling
Signed-off-by: Nathan Klick <[email protected]>
1 parent b44f85a commit 4d757d0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/core/config/remote/remote_config_manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {ErrorMessages} from '../../error_messages.js';
2525
import {CommonFlagsDataWrapper} from './common_flags_data_wrapper.js';
2626
import {type AnyObject} from '../../../types/aliases.js';
2727
import {NamespaceName} from '../../kube/namespace_name.js';
28+
import {ResourceNotFoundError} from '../../kube/errors/resource_operation_errors.js';
2829

2930
/**
3031
* Uses Kubernetes ConfigMaps to manage the remote configuration data by creating, loading, modifying,
@@ -261,7 +262,7 @@ export class RemoteConfigManager {
261262
try {
262263
return await this.k8.getNamespacedConfigMap(constants.SOLO_REMOTE_CONFIGMAP_NAME);
263264
} catch (error: any) {
264-
if (error.meta?.statusCode !== StatusCodes.NOT_FOUND) {
265+
if (!(error instanceof ResourceNotFoundError)) {
265266
throw new SoloError('Failed to read remote config from cluster', error);
266267
}
267268

src/core/kube/errors/resource_operation_errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export class ResourceOperationError extends SoloError {
2222
name: string,
2323
cause?: Error,
2424
) {
25-
super(`failed to ${operation} ${resourceType} ${name} in namespace ${namespace}: ${cause?.message}`, cause, {
25+
super(`failed to ${operation} ${resourceType} '${name}' in namespace '${namespace}'`, cause, {
2626
operation: operation,
2727
resourceType: resourceType,
28-
namespace: namespace,
28+
namespace: namespace?.name,
2929
name: name,
3030
});
3131
}

0 commit comments

Comments
 (0)