@@ -45,42 +45,42 @@ export class DocCodeGenState extends BaseCodeGenState {
4545 messenger . sendDocProgress ( this . tabID , DocGenerationStep . GENERATING_ARTIFACTS + 1 , 100 , ( messenger as any ) . mode )
4646 }
4747
48- protected handleError ( messenger : DocMessenger , detail ?: string ) : Error {
48+ protected handleError ( messenger : DocMessenger , codegenResult : any ) : Error {
4949 // eslint-disable-next-line unicorn/no-null
5050 messenger . sendUpdatePromptProgress ( this . tabID , null )
5151
5252 switch ( true ) {
53- case detail ?. includes ( 'README_TOO_LARGE' ) : {
53+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'README_TOO_LARGE' ) : {
5454 return new ReadmeTooLargeError ( )
5555 }
56- case detail ?. includes ( 'README_UPDATE_TOO_LARGE' ) : {
57- return new ReadmeUpdateTooLargeError ( this . codeGenerationRemainingIterationCount || 0 )
56+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'README_UPDATE_TOO_LARGE' ) : {
57+ return new ReadmeUpdateTooLargeError ( codegenResult . codeGenerationRemainingIterationCount || 0 )
5858 }
59- case detail ?. includes ( 'WORKSPACE_TOO_LARGE' ) : {
59+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'WORKSPACE_TOO_LARGE' ) : {
6060 return new ContentLengthError ( )
6161 }
62- case detail ?. includes ( 'WORKSPACE_EMPTY' ) : {
62+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'WORKSPACE_EMPTY' ) : {
6363 return new WorkspaceEmptyError ( )
6464 }
65- case detail ?. includes ( 'PROMPT_UNRELATED' ) : {
66- return new PromptUnrelatedError ( this . codeGenerationRemainingIterationCount || 0 )
65+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'PROMPT_UNRELATED' ) : {
66+ return new PromptUnrelatedError ( codegenResult . codeGenerationRemainingIterationCount || 0 )
6767 }
68- case detail ?. includes ( 'PROMPT_TOO_VAGUE' ) : {
69- return new PromptTooVagueError ( this . codeGenerationRemainingIterationCount || 0 )
68+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'PROMPT_TOO_VAGUE' ) : {
69+ return new PromptTooVagueError ( codegenResult . codeGenerationRemainingIterationCount || 0 )
7070 }
71- case detail ?. includes ( 'PROMPT_REFUSAL' ) : {
72- return new PromptRefusalException ( this . codeGenerationRemainingIterationCount || 0 )
71+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'PROMPT_REFUSAL' ) : {
72+ return new PromptRefusalException ( codegenResult . codeGenerationRemainingIterationCount || 0 )
7373 }
74- case detail ?. includes ( 'Guardrails' ) : {
74+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'Guardrails' ) : {
7575 return new DocServiceError ( i18n ( 'AWS.amazonq.doc.error.docGen.default' ) , 'GuardrailsException' )
7676 }
77- case detail ?. includes ( 'EmptyPatch' ) : {
78- if ( detail ?. includes ( 'NO_CHANGE_REQUIRED' ) ) {
77+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'EmptyPatch' ) : {
78+ if ( codegenResult . codeGenerationStatusDetail ?. includes ( 'NO_CHANGE_REQUIRED' ) ) {
7979 return new NoChangeRequiredException ( )
8080 }
8181 return new DocServiceError ( i18n ( 'AWS.amazonq.doc.error.docGen.default' ) , 'EmptyPatchException' )
8282 }
83- case detail ?. includes ( 'Throttling' ) : {
83+ case codegenResult . codeGenerationStatusDetail ?. includes ( 'Throttling' ) : {
8484 return new DocServiceError ( i18n ( 'AWS.amazonq.featureDev.error.throttling' ) , 'ThrottlingException' )
8585 }
8686 default : {
0 commit comments