feat(observability): add exception filter, logging interceptor, and CodeExecutorModule
- add HttpExceptionFilter logging BadRequestException at warn and InternalServerErrorException at error with cause chain
- add LoggingInterceptor logging request/response pairs at debug level with method, path, body, status, and duration
- extract CodeExecutorService into standalone CodeExecutorModule imported by BrowserModule and McpModule
- thread { cause: err } into all catch blocks across auth, browser, and code-executor services
This commit is contained in:
1 parent
bf1b6249a9
commit
5ac26ecb3a
13 files changed
+168
-19
No files matched your search
@@ -1,13 +1,17 @@
|
||||
import { Body, Controller, Post } from '@nestjs/common';
|
||||
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
|
||||
import { BrowserService, ExecResult, OpenResult } from './browser.service';
|
||||
import { CodeExecutorService } from '../code-executor/code-executor.service';
|
||||
import { OpenDto } from './dto/open.dto';
|
||||
import { ExecDto } from './dto/exec.dto';
|
||||
|
||||
@ApiTags('browser')
|
||||
@Controller()
|
||||
export class BrowserController {
|
||||
constructor(private readonly browserService: BrowserService) {}
|
||||
constructor(
|
||||
private readonly browserService: BrowserService,
|
||||
private readonly codeExecutor: CodeExecutorService,
|
||||
) {}
|
||||
|
||||
@Post('open')
|
||||
@ApiOperation({ summary: 'Open a URL with a stored session (cookies + localStorage)' })
|
||||
@@ -43,6 +47,7 @@ export class BrowserController {
|
||||
@ApiResponse({ status: 404, description: 'Session not found' })
|
||||
@ApiResponse({ status: 500, description: 'Execution failed' })
|
||||
exec(@Body() dto: ExecDto): Promise<ExecResult> {
|
||||
this.codeExecutor.validate(dto.code);
|
||||
return this.browserService.exec(dto.sessionName, dto.code, dto.url);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user