A Transaction won't catch an error, it allows you to recover gracefully from an error by using ROLLBACK to undo all the changes.
To catch the error will depend on the language you are accessing SQLite from.
For example, in C#:
using (SQLiteConnection con = new SQLiteConnection(strConnect))
{
con.Open();
using (SQLiteTransaction trans = con.BeginTransaction())
{
using (SQLiteCommand cmd = new SQLiteCommand("DELETE FROM Login", con))
{
try
{
sqCommand.ExecuteNonQuery();
sqCommand.CommandText = "DELETE FROM Branch";
sqCommand.ExecuteNonQuery();
trans.Commit();
}
catch(Exception e)
{
trans.Rollback();
... report problem, or log it ...
}
}
}
}