Improves API error handling in cleanup command
Enhances error reporting for different API error scenarios by: - Adding a generic API error handler for unspecified status codes - Preserving more detailed error information when possible - Providing clearer user notifications for various error types
This commit is contained in:
1 file changed
+6
-2
@@ -81,10 +81,14 @@ export class CleanupCommand {
|
||||
new Notice('API key error. Please check your settings.');
|
||||
} else if (error instanceof TextTooLongError) {
|
||||
new Notice(error.message);
|
||||
} else if (error instanceof ApiError && (error.status === 401 || error.status === 403)) {
|
||||
} else if (error instanceof ApiError) {
|
||||
if (error.status === 401 || error.status === 403) {
|
||||
new Notice('API key was rejected by the server. Please verify your key.');
|
||||
} else if (error instanceof ApiError && error.status === 429) {
|
||||
} else if (error.status === 429) {
|
||||
new Notice('Rate limited by API. Please wait and try again.');
|
||||
} else {
|
||||
new Notice(`API error (${error.status}): ${error.message}`);
|
||||
}
|
||||
} else if (error instanceof ServiceUnavailableError) {
|
||||
new Notice(error.message);
|
||||
} else if (error instanceof InvalidResponseError) {
|
||||
|
||||
Reference in new issue
Block a user