better error messages

This commit is contained in:
f0ldspace
2025-10-04 16:33:02 +01:00
parent af91511d3b
commit 659a95bcf1

View File

@@ -8,7 +8,7 @@ function M.setup(opts)
M.config = vim.tbl_deep_extend("force", M.config, opts or {}) M.config = vim.tbl_deep_extend("force", M.config, opts or {})
if not M.config.api_key then if not M.config.api_key then
vim.notify("Fatebook: no api", vim.log.levels.ERROR) vim.notify("Fatebook: No API key found.", vim.log.levels.ERROR)
end end
end end
@@ -34,13 +34,13 @@ end
function M.create_prediction(question, forecast, date) function M.create_prediction(question, forecast, date)
if not M.config.api_key then if not M.config.api_key then
vim.notify("Fatebook: No API", vim.log.levels.ERROR) vim.notify("Fatebook: No API found.", vim.log.levels.ERROR)
return return
end end
local forecast_num = tonumber(forecast) local forecast_num = tonumber(forecast)
if not forecast_num or forecast_num < 0 or forecast_num > 100 then if not forecast_num or forecast_num < 0 or forecast_num > 100 then
vim.notify("Fatebook: Forecast issue", vim.log.levels.ERROR) vim.notify("Fatebook: Forecast out of range, use between 0-100", vim.log.levels.ERROR)
return return
end end