feat: Implement platform service providers for MinIO and MongoDB
- Added base interface and abstract class for platform service providers. - Created MinIOProvider class for S3-compatible storage with deployment, provisioning, and deprovisioning functionalities. - Implemented MongoDBProvider class for MongoDB service with similar capabilities. - Introduced error handling utilities for better error management. - Developed TokensComponent for managing registry tokens in the UI, including creation, deletion, and display of tokens.
This commit is contained in:
43
ts/utils/error.ts
Normal file
43
ts/utils/error.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Error handling utilities for TypeScript strict mode compatibility
|
||||
*/
|
||||
|
||||
/**
|
||||
* Safely extract error message from unknown error type
|
||||
*/
|
||||
export function getErrorMessage(error: unknown): string {
|
||||
if (error instanceof Error) {
|
||||
return error.message;
|
||||
}
|
||||
return String(error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely extract error stack from unknown error type
|
||||
*/
|
||||
export function getErrorStack(error: unknown): string | undefined {
|
||||
if (error instanceof Error) {
|
||||
return error.stack;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely extract error name from unknown error type
|
||||
*/
|
||||
export function getErrorName(error: unknown): string {
|
||||
if (error instanceof Error) {
|
||||
return error.name;
|
||||
}
|
||||
return 'Error';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if error is a specific error type by name
|
||||
*/
|
||||
export function isErrorType(error: unknown, name: string): boolean {
|
||||
if (error instanceof Error) {
|
||||
return error.name === name;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user