code: function(e) {
              // If DONE (cancelled), then don't do anything
              if (me.readyState === FileWriter.DONE) {
                  return;
              }
  
              // DONE state
              me.readyState = FileWriter.DONE;
  
              // Save error
              me.error = new FileError(e);
  
              // If onerror callback
              if (typeof me.onerror === "function") {
                  me.onerror(new ProgressEvent("error", {"target":me}));
              }
  
              // If onwriteend callback
              if (typeof me.onwriteend === "function") {
                  me.onwriteend(new ProgressEvent("writeend", {"target":me}));
              }
          }
docs: Error callback