Commit 2d581d5e26ada49ca088f855fb0c84c4a6f129c6
informative error for avatar names
Dominic Tarr committed on 3/17/2017, 12:36:47 PMParent: da92416fcd8422bf818f5d6ceccfb9ed382cf2d6
Files changed
modules_basic/avatar/name.js | changed |
modules_basic/avatar/name.js | ||
---|---|---|
@@ -8,10 +8,14 @@ | ||
8 | 8 … | |
9 | 9 … | exports.create = function (api) { |
10 | 10 … | |
11 | 11 … | return function name (id) { |
12 | - var n = h('span', id ? id.substring(0, 10) : "") | |
13 | 12 … | |
13 … | + if('string' !== typeof id) | |
14 … | + throw new Error('avatar id must be a string') | |
15 … | + | |
16 … | + var n = h('span', id ? id.substring(0, 10) : JSON.stringify(id)) | |
17 … | + | |
14 | 18 … | //choose the most popular name for this person. |
15 | 19 … | //for anything like this you'll see I have used sbot.links2 |
16 | 20 … | //which is the ssb-links plugin. as you'll see the query interface |
17 | 21 … | //is pretty powerful! |
@@ -26,4 +30,6 @@ | ||
26 | 30 … | } |
27 | 31 … | |
28 | 32 … | } |
29 | 33 … | |
34 … | + | |
35 … | + |
Built with git-ssb-web