Skip to content

Commit

Permalink
Bug 1898509 - more details for SQL errors
Browse files Browse the repository at this point in the history
The goal here is to track down some foreign key failures that we're
seeing, but don't have any context on where they're happening.

- Record a breadcrumb when we start to ingest different suggestion types.
- Record what we were doing when we saw an SQL error.  This should
  change the message from `FOREIGN KEY constraint failed` to something
  like `FOREIGN KEY constraint failed (context: mdn insert)`, which I
  think will help greatly.

I wanted to also record which field the foreign key error was happening
on, but AFAICT this is not possible with SQLite.

I added the `extend` crate to help with some of this code.  It's not
really needed, but I think it's worth the dependency. We've been using
it for `uniffi-bindgen-gecko-js` so it's already vetted.
  • Loading branch information
bendk committed Jun 3, 2024
1 parent c148e60 commit 7f96b23
Show file tree
Hide file tree
Showing 9 changed files with 281 additions and 127 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ the details of which are reproduced below.
* [MIT License: bytes](#mit-license-bytes)
* [MIT License: cargo_metadata](#mit-license-cargo_metadata)
* [MIT License: caseless](#mit-license-caseless)
* [MIT License: extend](#mit-license-extend)
* [MIT License: generic-array](#mit-license-generic-array)
* [MIT License: goblin](#mit-license-goblin)
* [MIT License: h2](#mit-license-h2)
Expand Down Expand Up @@ -992,6 +993,34 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
-------------
## MIT License: extend

The following text applies to code linked from these dependencies:
[extend](https://github.com/davidpdrsn/extend)

```
MIT License Copyright (c) 2020 David Pedersen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```
-------------
## MIT License: generic-array
Expand Down
2 changes: 2 additions & 0 deletions components/suggest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ exclude = ["/android", "/ios"]
[dependencies]
anyhow = "1.0"
chrono = "0.4"
extend = "1.1"
interrupt-support = { path = "../support/interrupt" }
log = "0.4"
once_cell = "1.5"
parking_lot = ">=0.11,<=0.12"
remote_settings = { path = "../remote_settings" }
Expand Down
Loading

0 comments on commit 7f96b23

Please sign in to comment.