fix(core): Improve model sub-nodes error handling (#11418)

This commit is contained in:
Eugene
2024-11-08 10:17:11 +01:00
committed by GitHub
parent b496bf3147
commit 57467d0285
24 changed files with 310 additions and 56 deletions

View File

@@ -17,6 +17,7 @@ import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
import { N8nLlmTracing } from '../N8nLlmTracing';
import { additionalOptions } from '../gemini-common/additional-options';
import { makeErrorFromStatus } from './error-handling';
import { makeN8nLlmFailedAttemptHandler } from '../n8nLlmFailedAttemptHandler';
export class LmChatGoogleVertex implements INodeType {
description: INodeTypeDescription = {
@@ -170,7 +171,8 @@ export class LmChatGoogleVertex implements INodeType {
safetySettings,
callbacks: [new N8nLlmTracing(this)],
// Handle ChatVertexAI invocation errors to provide better error messages
onFailedAttempt: (error: any) => {
onFailedAttempt: makeN8nLlmFailedAttemptHandler(this, (error: any) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const customError = makeErrorFromStatus(Number(error?.response?.status), {
modelName,
});
@@ -180,7 +182,7 @@ export class LmChatGoogleVertex implements INodeType {
}
throw error;
},
}),
});
return {