comparison avatar.js @ 1:0c19fadfc12d

Serve the right error message when the TYPE of the PHOTO is missing.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 31 Mar 2011 00:35:19 +0200
parents d5cfe54f11aa
children ad496e8a5e66
comparison
equal deleted inserted replaced
0:d5cfe54f11aa 1:0c19fadfc12d
137 return; 137 return;
138 } 138 }
139 139
140 try { 140 try {
141 var photo = vCard.getChild('PHOTO', 'vcard-temp'); 141 var photo = vCard.getChild('PHOTO', 'vcard-temp');
142 var type = photo.getChild('TYPE', 'vcard-temp').getText();
143 var base64 = photo.getChild('BINVAL', 'vcard-temp').getText(); 142 var base64 = photo.getChild('BINVAL', 'vcard-temp').getText();
143
144 try {
145 var type = photo.getChild('TYPE', 'vcard-temp').getText();
146 } catch (e) {
147 res.writeHead(500, {'Content-Type': 'text/plain'});
148 res.end('Error: this user’s vCard doesn’t specify the MIME type of its avatar.');
149 }
144 150
145 var ext; 151 var ext;
146 for (var i in extensions) 152 for (var i in extensions)
147 if (type == extensions[i]) 153 if (type == extensions[i])
148 ext = i; 154 ext = i;