Introduce new inline chat error type for showing to the user (#208098)

Introduce new error type for showing to the user
This commit is contained in:
Logan Ramos
2024-03-19 08:56:09 -07:00
committed by GitHub
parent fd4b93963e
commit 811ce8a51f
2 changed files with 25 additions and 7 deletions

View File

@@ -33,6 +33,14 @@ type SessionData = {
store: IDisposable;
};
export class InlineChatError extends Error {
static readonly code = 'InlineChatError';
constructor(message: string) {
super(message);
this.name = InlineChatError.code;
}
}
export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
declare _serviceBrand: undefined;
@@ -92,7 +100,7 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
} catch (error) {
this._logService.error('[IE] FAILED to prepare session', provider.debugName);
this._logService.error(error);
return undefined;
throw new InlineChatError((error as Error)?.message || 'Failed to prepare session');
}
if (!rawSession) {
this._logService.trace('[IE] NO session', provider.debugName);