Software / code / prosody
Comparison
core/configmanager.lua @ 9876:d812031c8716
configmanager: Pass through warnings from included files
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 20 Mar 2019 12:45:08 +0000 |
| parent | 9875:99291e124449 |
| child | 10198:83541f0ff14f |
comparison
equal
deleted
inserted
replaced
| 9875:99291e124449 | 9876:d812031c8716 |
|---|---|
| 5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
| 6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
| 7 -- | 7 -- |
| 8 | 8 |
| 9 local _G = _G; | 9 local _G = _G; |
| 10 local setmetatable, rawget, rawset, io, os, error, dofile, type, pairs = | 10 local setmetatable, rawget, rawset, io, os, error, dofile, type, pairs, ipairs = |
| 11 setmetatable, rawget, rawset, io, os, error, dofile, type, pairs; | 11 setmetatable, rawget, rawset, io, os, error, dofile, type, pairs, ipairs; |
| 12 local format, math_max, t_insert = string.format, math.max, table.insert; | 12 local format, math_max, t_insert = string.format, math.max, table.insert; |
| 13 | 13 |
| 14 local envload = require"util.envload".envload; | 14 local envload = require"util.envload".envload; |
| 15 local deps = require"util.dependencies"; | 15 local deps = require"util.dependencies"; |
| 16 local resolve_relative_path = require"util.paths".resolve_relative_path; | 16 local resolve_relative_path = require"util.paths".resolve_relative_path; |
| 210 file = resolve_relative_path(config_file:gsub("[^"..path_sep.."]+$", ""), file); | 210 file = resolve_relative_path(config_file:gsub("[^"..path_sep.."]+$", ""), file); |
| 211 local f, err = io.open(file); | 211 local f, err = io.open(file); |
| 212 if f then | 212 if f then |
| 213 local ret, err = parser.load(f:read("*a"), file, config_table); | 213 local ret, err = parser.load(f:read("*a"), file, config_table); |
| 214 if not ret then error(err:gsub("%[string.-%]", file), 0); end | 214 if not ret then error(err:gsub("%[string.-%]", file), 0); end |
| 215 if err then | |
| 216 for _, warning in ipairs(err) do | |
| 217 t_insert(warnings, warning); | |
| 218 end | |
| 219 end | |
| 215 end | 220 end |
| 216 if not f then error("Error loading included "..file..": "..err, 0); end | 221 if not f then error("Error loading included "..file..": "..err, 0); end |
| 217 return f, err; | 222 return f, err; |
| 218 end | 223 end |
| 219 env.include = env.Include; | 224 env.include = env.Include; |