-
Notifications
You must be signed in to change notification settings - Fork 0
debug fn response
awekrx edited this page May 29, 2026
·
1 revision
import { debugFnResponse } from '@dev-suite/decorators/debug-fn-response'
method
Log method response/error consistently for diagnostics.
- Inline response logging and try/catch console blocks
- Different log shape in each method
class SyncService {
async sync() {
try {
const result = await this.engine.sync();
console.log('sync result', result);
return result;
} catch (error) {
console.error('sync error', error);
throw error;
}
}
}import { debugFnResponse } from '@dev-suite/decorators/debug-fn-response';
class SyncService {
@debugFnResponse({ label: 'sync.run' })
async sync() {
return this.engine.sync();
}
}- Response/error logging is centralized and consistent.
- Method logic remains focused on workflow.
class ExportService {
async export(id: string) {
const data = await this.repo.load(id);
console.log('export size', data.length);
return data;
}
}import { debugFnResponse } from '@dev-suite/decorators/debug-fn-response';
class ExportService {
@debugFnResponse({ formatResponse: (data: Uint8Array) => ({ bytes: data.length }) })
async export(id: string) {
return this.repo.load(id);
}
}- Can log summarized response shape safely.
- Removes repetitive size/debug statements.