How can I handle SQLlite error before program is terminated?
example:
- column 'mac' is primary key, unique
- record with mac "3c-a6-2f-a4-00-60" already exist in database
when I execute:
db:exec("INSERT INTO hosts (mac, ip,) VALUES(?,?)", "3c-a6-2f-a4-00-60", "192.168.0.1")
SQLite error: UNIQUE constraint failed is displayed and program terminated.
I tried with pcall or assert but none helps