From b9df78e4494879752e9e68dcc5d54e03fffe9467 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 28 Oct 2017 23:48:07 +0200 Subject: Move DatabaseError handling into Qlite --- qlite/src/upsert_builder.vala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'qlite/src/upsert_builder.vala') diff --git a/qlite/src/upsert_builder.vala b/qlite/src/upsert_builder.vala index eb835027..54ba9924 100644 --- a/qlite/src/upsert_builder.vala +++ b/qlite/src/upsert_builder.vala @@ -26,14 +26,14 @@ public class UpsertBuilder : StatementBuilder { return this; } - public UpsertBuilder value_null(Column column) throws DatabaseError { - if (column.not_null) throw new DatabaseError.ILLEGAL_QUERY(@"Can't set non-null column $(column.name) to null"); + public UpsertBuilder value_null(Column column) { + if (column.not_null) error("Can't set non-null column %s to null", column.name); fields += new NullField(column); return this; } - internal override Statement prepare() throws DatabaseError { - throw new DatabaseError.NOT_SUPPORTED("prepare() not available for upsert."); + internal override Statement prepare() { + error("prepare() not available for upsert."); } internal Statement prepare_update() { @@ -98,13 +98,13 @@ public class UpsertBuilder : StatementBuilder { return stmt; } - public int64 perform() throws DatabaseError { + public int64 perform() { if (prepare_update().step() != DONE || prepare_insert().step() != DONE) { - throw new DatabaseError.EXEC_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())"); + error(@"SQLite error: %d - %s", db.errcode(), db.errmsg()); } return db.last_insert_rowid(); } } -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf