Software / code / prosody
Comparison
util/error.lua @ 10069:6f317e51544d
util.error: Fix traceback due to missing text field
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 10 Jul 2019 17:04:36 +0200 |
| parent | 9749:9361bd1b9c9b |
| child | 10365:744ca71a49f7 |
comparison
equal
deleted
inserted
replaced
| 10068:73a8192058f9 | 10069:6f317e51544d |
|---|---|
| 1 local error_mt = { __name = "error" }; | 1 local error_mt = { __name = "error" }; |
| 2 | 2 |
| 3 function error_mt:__tostring() | 3 function error_mt:__tostring() |
| 4 return ("error<%s:%s:%s>"):format(self.type, self.condition, self.text); | 4 return ("error<%s:%s:%s>"):format(self.type, self.condition, self.text or ""); |
| 5 end | 5 end |
| 6 | 6 |
| 7 local function is_err(e) | 7 local function is_err(e) |
| 8 return getmetatable(e) == error_mt; | 8 return getmetatable(e) == error_mt; |
| 9 end | 9 end |