Bug/gh issues fiz (#1103)
* refactor: optimize page loading and data fetching * fix: resolve recurring production runtime errors * feat: add MCP company and customer updates * fix: handle year-end tax adjustments * feat: harden annual report compliance * fix: expand invoice logo and font support * fix: sanitize API route error responses * fix: sanitize user-facing error messages * feat: persist onboarding and tax assessment notices * fix: reduce cloud backup audit churn * feat: refine invoice editor layout * fix: show saved tax adjustments in INK2 * fix: complete annual report API mappings * docs: record operational safeguards and decisions * fix: harden annual report review findings * fix: adjust column span for description based on VAT registration * New css class name
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
} from '@/lib/tax/deadline-generator'
|
||||
import { validateBody } from '@/lib/api/validate'
|
||||
import { UpdateSettingsSchema } from '@/lib/api/schemas'
|
||||
import { getErrorMessage as getUserErrorMessage } from '@/lib/errors/get-error-message'
|
||||
|
||||
export const GET = withRouteContext(
|
||||
'settings.get',
|
||||
@@ -20,7 +21,7 @@ export const GET = withRouteContext(
|
||||
.single()
|
||||
|
||||
if (error) {
|
||||
return NextResponse.json({ error: error.message }, { status: 500 })
|
||||
return NextResponse.json({ error: getUserErrorMessage(error) }, { status: 500 })
|
||||
}
|
||||
|
||||
// Fall back to companies.entity_type if company_settings.entity_type is null
|
||||
@@ -99,7 +100,7 @@ export const PUT = withRouteContext(
|
||||
// Fail closed: a failed check must not let the basis change through
|
||||
// and orphan open vacation-ledger rows.
|
||||
if (openRowsError) {
|
||||
return NextResponse.json({ error: openRowsError.message }, { status: 500 })
|
||||
return NextResponse.json({ error: getUserErrorMessage(openRowsError) }, { status: 500 })
|
||||
}
|
||||
if ((openRows ?? 0) > 0) {
|
||||
return NextResponse.json(
|
||||
@@ -182,7 +183,7 @@ export const PUT = withRouteContext(
|
||||
if (error.code === 'PGRST116') {
|
||||
return NextResponse.json({ error: 'Inställningarna hittades inte.' }, { status: 404 })
|
||||
}
|
||||
return NextResponse.json({ error: error.message }, { status: 500 })
|
||||
return NextResponse.json({ error: getUserErrorMessage(error) }, { status: 500 })
|
||||
}
|
||||
|
||||
// Regenerate when the save touches tax-relevant fields: the statutory
|
||||
|
||||
Reference in New Issue
Block a user