fix(journal-entry): add error logging for delete operation in journal… (#379)
* fix(journal-entry): add error logging for delete operation in journal entries * fix(journal-entry): enhance error logging and add tests for delete_last_voucher functionality * fix(journal-entry): restore enforce_journal_entry_immutability function to handle DELETE and un-reversal updates * fix(tests): refactor delete_last_voucher tests to use insertPostedEntryWithLines for consistency
This commit is contained in:
@@ -5,6 +5,9 @@ import { requireWritePermission } from '@/lib/auth/require-write'
|
||||
import { ensureInitialized } from '@/lib/init'
|
||||
import { eventBus } from '@/lib/events/bus'
|
||||
import { getErrorMessage } from '@/lib/errors/get-error-message'
|
||||
import { createLogger } from '@/lib/logger'
|
||||
|
||||
const logger = createLogger('journal-entries')
|
||||
|
||||
ensureInitialized()
|
||||
|
||||
@@ -59,6 +62,7 @@ export async function DELETE(
|
||||
})
|
||||
|
||||
if (error) {
|
||||
logger.error('delete_last_voucher failed', { entryId: id, error })
|
||||
return NextResponse.json(
|
||||
{ error: getErrorMessage(error, { context: 'journal_entry', statusCode: 400 }) },
|
||||
{ status: 400 }
|
||||
|
||||
Reference in New Issue
Block a user