Description
After a recent update, editing products on the demo site frequently fails with a mutation error and the product changes don't save. A toast appears saying "product not saved" but no further diagnostic detail is surfaced.
Error Details
{
"category": "wcpos.mutations.document",
"errorCode": "DB01003",
"collectionName": "products",
"operation": "mutation",
"documentId": 25
}
DB01003 is TRANSACTION_FAILED — see packages/utils/src/logger/error-codes.ts:64.
Where it's thrown
In packages/core/src/screens/main/hooks/mutations/use-mutation.ts:95-115, TRANSACTION_FAILED is the fallback errorCode used when:
- The thrown error is not an rxdb error (no
error.rxdb flag), OR
- The rxdb error code doesn't match any known case in the
switch
This means the underlying error reason is being swallowed — we only see the generic fallback code and not the actual cause (e.g. network failure, validation, conflict, etc.).
Reproduction
- Open the demo site in the POS
- Edit a product (e.g. document
25)
- Attempt to save — mutation fails intermittently ("quite often")
- Toast shows "product not saved" but no detail
Suspected Issues
The underlying error message is not being captured/logged with enough fidelity to diagnose. The log entry should include the original error message, stack, and rxdb code if available, so the actual cause (network failure, server-side rejection, conflict, etc.) can be identified from the logs.
Suggested Next Steps
- Improve
handleError in use-mutation.ts to always log the original error.message and error.code to the context, even when falling through to TRANSACTION_FAILED.
- Reproduce against the demo site and capture the underlying rxdb / network error.
Description
After a recent update, editing products on the demo site frequently fails with a mutation error and the product changes don't save. A toast appears saying "product not saved" but no further diagnostic detail is surfaced.
Error Details
{ "category": "wcpos.mutations.document", "errorCode": "DB01003", "collectionName": "products", "operation": "mutation", "documentId": 25 }DB01003isTRANSACTION_FAILED— seepackages/utils/src/logger/error-codes.ts:64.Where it's thrown
In
packages/core/src/screens/main/hooks/mutations/use-mutation.ts:95-115,TRANSACTION_FAILEDis the fallback errorCode used when:error.rxdbflag), ORswitchThis means the underlying error reason is being swallowed — we only see the generic fallback code and not the actual cause (e.g. network failure, validation, conflict, etc.).
Reproduction
25)Suspected Issues
The underlying error message is not being captured/logged with enough fidelity to diagnose. The log entry should include the original error message, stack, and rxdb code if available, so the actual cause (network failure, server-side rejection, conflict, etc.) can be identified from the logs.
Suggested Next Steps
handleErrorinuse-mutation.tsto always log the originalerror.messageanderror.codeto the context, even when falling through toTRANSACTION_FAILED.