eGovPDX / Council-Agenda-App

5 stars 0 forks source link

Need Better Error Handling #55

Open OscarGodson opened 13 years ago

OscarGodson commented 13 years ago

I started to do it, but then I got lazy. Everything that gets a return should be wrapped in an error like this:

app().api({
  "action":"create",
  "emergency":emergencyItem,
  "type":type,
  "heading":modal.find('[name=heading]').val(),
  "topic":modal.find('[name=topic]').val(),
  "id":$('.session:first').attr('id').split('-')[1]
},
function(json){
  if(!json.error){
    addRemoveBureausOwners('owner',json.item_id);
    addRemoveBureausOwners('bureau',json.item_id);
    displayAgenda(dataStore('active-agenda'));
    app().modal('close')
  }
  else{
    alert('Error: '+json.error);
  }
});

Marked as a feature because it'll help for debugging purposes for them.