Software / code / prosody
Comparison
util/error.lua @ 11075:d8fad2b48b05
util.error: Add unique 'instance_id' to error objects
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 25 Sep 2020 12:18:18 +0100 |
| parent | 11054:ad07152d7bde |
| child | 11076:505c3e5907a5 |
comparison
equal
deleted
inserted
replaced
| 11074:3473bc8d80c9 | 11075:d8fad2b48b05 |
|---|---|
| 1 local id = require "util.id"; | |
| 1 | 2 |
| 2 -- Library configuration (see configure()) | 3 -- Library configuration (see configure()) |
| 3 local auto_inject_traceback = false; | 4 local auto_inject_traceback = false; |
| 4 local display_tracebacks = false; | 5 local display_tracebacks = false; |
| 5 | 6 |
| 40 if auto_inject_traceback then | 41 if auto_inject_traceback then |
| 41 context.traceback = debug.traceback("error stack", 2); | 42 context.traceback = debug.traceback("error stack", 2); |
| 42 end | 43 end |
| 43 | 44 |
| 44 return setmetatable({ | 45 return setmetatable({ |
| 46 instance_id = id.short(); | |
| 45 type = template.type or "cancel"; | 47 type = template.type or "cancel"; |
| 46 condition = template.condition or "undefined-condition"; | 48 condition = template.condition or "undefined-condition"; |
| 47 text = template.text; | 49 text = template.text; |
| 48 code = template.code; | 50 code = template.code; |
| 49 | 51 |