userDetails should handle errors properly

This commit is contained in:
Tom MacWright
2013-02-04 16:48:44 -05:00
parent e5807e906d
commit b7cfaf08da
2 changed files with 4 additions and 1 deletions

View File

@@ -208,6 +208,7 @@ iD.Connection = function(context) {
function userDetails(callback) {
function done(err, user_details) {
if (err) return callback(err);
var u = user_details.getElementsByTagName('user')[0],
img = u.getElementsByTagName('img'),
image_url = '';

View File

@@ -5,10 +5,12 @@ iD.ui.userpanel = function(connection) {
function update() {
if (connection.authenticated()) {
selection.style('display', 'block');
connection.userDetails(function(user_details) {
connection.userDetails(function(err, user_details) {
selection.html('');
if (err) return;
// Link
var userLink = selection.append('a')
.attr('href', connection.url() + '/user/' +