Software / code / prosody
Comparison
util/error.lua @ 11102:5a0ff475ecfd
util.error: Drop registry initialization with namespace as key
Enough complexity with compact vs normal and with/without namespace
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 28 Sep 2020 23:48:02 +0200 |
| parent | 11101:2288d206b14b |
| child | 11161:f51ed2652602 |
comparison
equal
deleted
inserted
replaced
| 11101:2288d206b14b | 11102:5a0ff475ecfd |
|---|---|
| 90 | 90 |
| 91 local function init(source, namespace, registry) | 91 local function init(source, namespace, registry) |
| 92 if type(namespace) == "table" then | 92 if type(namespace) == "table" then |
| 93 -- registry can be given as second argument if namespace is either not used | 93 -- registry can be given as second argument if namespace is either not used |
| 94 registry, namespace = namespace, nil; | 94 registry, namespace = namespace, nil; |
| 95 if type(registry.namespace) == "string" then | |
| 96 -- error templates are always type table, so this can't be one | |
| 97 namespace, registry.namespace = registry.namespace, nil; | |
| 98 end | |
| 99 end | 95 end |
| 100 local _, protoerr = next(registry, nil); | 96 local _, protoerr = next(registry, nil); |
| 101 if protoerr and type(next(protoerr)) == "number" then | 97 if protoerr and type(next(protoerr)) == "number" then |
| 102 registry = expand_registry(namespace, registry); | 98 registry = expand_registry(namespace, registry); |
| 103 end | 99 end |