mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Unifying File API error code/response style
This commit is contained in:
parent
45d75524c9
commit
8b12bf79e4
@ -199,32 +199,23 @@ public class FileUtils extends Plugin {
|
|||||||
}
|
}
|
||||||
return new PluginResult(status, result);
|
return new PluginResult(status, result);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.NOT_FOUND_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.NOT_FOUND_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
} catch (FileExistsException e) {
|
} catch (FileExistsException e) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.PATH_EXISTS_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.PATH_EXISTS_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
} catch (NoModificationAllowedException e) {
|
} catch (NoModificationAllowedException e) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
} catch (InvalidModificationException e) {
|
} catch (InvalidModificationException e) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.INVALID_MODIFICATION_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.INVALID_MODIFICATION_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.ENCODING_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.ENCODING_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.INVALID_MODIFICATION_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.INVALID_MODIFICATION_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
} catch (EncodingException e) {
|
} catch (EncodingException e) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.ENCODING_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.ENCODING_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
} catch (TypeMismatchException e) {
|
} catch (TypeMismatchException e) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.TYPE_MISMATCH_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.TYPE_MISMATCH_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user