Software / code / prosody
Comparison
net/connlisteners.lua @ 624:04fe1a00aa16
Protect loading of connlisteners, to catch errors
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 16 Dec 2008 02:32:01 +0000 |
| parent | 615:4ae3e81513f3 |
| child | 658:1952fdcf1017 |
comparison
equal
deleted
inserted
replaced
| 623:5af5a64a729f | 624:04fe1a00aa16 |
|---|---|
| 45 end | 45 end |
| 46 | 46 |
| 47 function get(name) | 47 function get(name) |
| 48 local h = listeners[name]; | 48 local h = listeners[name]; |
| 49 if not h then | 49 if not h then |
| 50 pcall(dofile, listeners_dir..name:gsub("[^%w%-]", "_").."_listener.lua"); | 50 local ok, ret = pcall(dofile, listeners_dir..name:gsub("[^%w%-]", "_").."_listener.lua"); |
| 51 if not ok then return nil, ret; end | |
| 51 h = listeners[name]; | 52 h = listeners[name]; |
| 52 end | 53 end |
| 53 return h; | 54 return h; |
| 54 end | 55 end |
| 55 | 56 |