Add a types module to help refactor type checking
Type checking will be performed in unit tests, but will be an empty function at runtime.
This commit is contained in:
parent
647e7f2ac2
commit
ec6aed9866
|
@ -44,4 +44,8 @@ function types.matches_pattern(pattern)
|
|||
end
|
||||
end
|
||||
|
||||
function types.check(...)
|
||||
|
||||
end
|
||||
|
||||
return types
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
|
||||
local sql = require("lsqlite3")
|
||||
local config = require("config")
|
||||
local types = require("types")
|
||||
local util = {}
|
||||
|
||||
--[[
|
||||
Runs an sql query and receives the 3 arguments back, prints a nice error
|
||||
message on fail, and returns true on success.
|
||||
]]
|
||||
function util.sqlassert(...)
|
||||
local r,errcode,err = ...
|
||||
function util.sqlassert(r, errcode, err)
|
||||
if not r then
|
||||
error(string.format("%d: %s",errcode, err))
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue