Report more detailed errors in the mozStorage Rust binding

RESOLVED FIXED in Firefox 68

Status

()

enhancement
RESOLVED FIXED
3 months ago
3 months ago

People

(Reporter: lina, Assigned: lina)

Tracking

unspecified
mozilla68
Points:
---

Firefox Tracking Flags

(firefox68 fixed)

Details

Attachments

(1 attachment)

Currently, all the Rust storage methods return nsresults, which are super generic. NS_ERROR_FAILURE can mean a SQL syntax error, exceeding the binding param limit (ahem bug 1539691), an invalid column name, an error in a function call, an error in a trigger...

Running Firefox with env MOZ_LOG=timestamp,mozStorage:5 ./firefox turns on mozStorage logging, but we also want to write more detailed errors into Sync logs, and make them available in Sync telemetry for analysis.

Assignee

Comment 1

3 months ago

The nsresult codes that mozStorage returns are often too generic. For
example, NS_ERROR_FAILURE might be anything from a SQL syntax error
to an invalid column name in a trigger.

This commit adds a Conn::call_and_wrap_error helper that checks the
last SQLite error, and returns that instead of nsresult. Not all
errors are SQLite errors, however, so we only use this for mozStorage
methods that return convertResultCode.

Comment 2

3 months ago
Pushed by kcambridge@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b052410b6673
Report more detailed errors in the mozStorage Rust binding. r=mak,tcsc

Comment 3

3 months ago
bugherder
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.