I think we do that:
request.onerror = function onError(event) {
  var errorName = event.target.error.name;
  onerror && onerror(errorName);
};
for keeping no UI code in message_manager.js.

It's more maintainable, right?