feat(error-handling): Implement comprehensive gateway error handling with user-friendly messages
- Add comprehensive gateway error handler with friendly user messages - Handle subscription status errors (inactive BYOK, subscription required) - Handle authentication errors (invalid API keys, missing tokens) - Handle rate limiting with retry suggestions - Handle model availability and validation errors - Handle network connectivity issues - Provide actionable solutions for each error type - Prevent duplicate error messages by returning early after showing friendly error - Fix telemetry tests to use correct environment variable names (TASKMASTER_API_KEY) - Fix config manager getUserId function to properly save default userId to file - All tests now passing (34 test suites, 360 tests)
This commit is contained in:
@@ -89,10 +89,10 @@ const DEFAULT_CONFIG = {
|
||||
},
|
||||
},
|
||||
account: {
|
||||
userId: null,
|
||||
userEmail: "",
|
||||
userId: "1234567890",
|
||||
email: "",
|
||||
mode: "byok",
|
||||
telemetryEnabled: false,
|
||||
telemetryEnabled: true,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -333,7 +333,6 @@ describe("getConfig Tests", () => {
|
||||
},
|
||||
global: { ...DEFAULT_CONFIG.global, ...VALID_CUSTOM_CONFIG.global },
|
||||
account: { ...DEFAULT_CONFIG.account },
|
||||
ai: {},
|
||||
};
|
||||
expect(config).toEqual(expectedMergedConfig);
|
||||
expect(fsExistsSyncSpy).toHaveBeenCalledWith(MOCK_CONFIG_PATH);
|
||||
@@ -357,7 +356,6 @@ describe("getConfig Tests", () => {
|
||||
},
|
||||
global: { ...DEFAULT_CONFIG.global, ...PARTIAL_CONFIG.global },
|
||||
account: { ...DEFAULT_CONFIG.account },
|
||||
ai: {},
|
||||
};
|
||||
expect(config).toEqual(expectedMergedConfig);
|
||||
expect(fsReadFileSyncSpy).toHaveBeenCalledWith(MOCK_CONFIG_PATH, "utf-8");
|
||||
@@ -463,7 +461,6 @@ describe("getConfig Tests", () => {
|
||||
},
|
||||
global: { ...DEFAULT_CONFIG.global, ...INVALID_PROVIDER_CONFIG.global },
|
||||
account: { ...DEFAULT_CONFIG.account },
|
||||
ai: {},
|
||||
};
|
||||
expect(config).toEqual(expectedMergedConfig);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user