Skip to content

Commit c47faa8

Browse files
committed
log all database errors
1 parent 939f257 commit c47faa8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- The error message now always includes the name of the file where the error occurred, which is useful when embedding SQLPage pages using `sqlpage.run_sql`, or the card component.
3737
- When an error occurs while executing a SQL statement, the error message now always includes the (potentially transformed) SQL statement that was sent to the database.
3838
- Fixed a problem where database errors would be displayed twice in the error message.
39+
- Database errors now always trigger warning messages in the console, in addition to the error message displayed in the browser. This allows the application's administrator to be alerted and fix errors faster, without having to wait for a user to report the error.
3940
- Fixed layout issues in the card component when embedding content with `embed`: remove double border and padding.
4041
- ![embedded card screenshot](https://github.com/user-attachments/assets/ea85438d-5fcb-4eed-b90b-a4385675355d)
4142
- Added support for `empty_option` in the form component to add an empty option before the options defined in `options`. Useful when generating other options from a database table.

src/webserver/database/execute_queries.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,11 @@ fn parse_single_sql_result(
234234
log::debug!("Finished query with result: {:?}", res);
235235
DbItem::FinishedQuery
236236
}
237-
Err(err) => DbItem::Error(display_db_error(source_file, sql, err)),
237+
Err(err) => {
238+
let nice_err = display_db_error(source_file, sql, err);
239+
log::error!("{:?}", nice_err);
240+
DbItem::Error(nice_err)
241+
}
238242
}
239243
}
240244

0 commit comments

Comments
 (0)