fix: harden store writes, strict schemas, null cfg
This commit is contained in:
@@ -74,6 +74,17 @@ describe('formatDbError', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('joins detail and hint', () => {
|
||||
const error = Object.assign(new Error('boom'), {
|
||||
code: '23505',
|
||||
detail: 'Key (id)=(1) already exists.',
|
||||
hint: 'use upsert'
|
||||
})
|
||||
expect(formatDbError('postgres', error)).toBe(
|
||||
'[postgres 23505] boom (Key (id)=(1) already exists. | use upsert)'
|
||||
)
|
||||
})
|
||||
|
||||
it('handles non-Error values', () => {
|
||||
expect(formatDbError('mysql', 'boom')).toBe('[mysql] boom')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user