cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabbage <...@git.apache.org>
Subject [GitHub] cordova-plugin-file pull request: Add error codes.
Date Wed, 09 Apr 2014 18:48:16 GMT
Github user purplecabbage commented on the pull request:

    https://github.com/apache/cordova-plugin-file/pull/37#issuecomment-40001813
  
    +1
    It may be good to provide a better example of error handling as well. I would expect having
a function like this that you could just copy into your code would also help.
    
    ```
    function handleError(err) {
        switch(err) {
            case FileError.NOT_FOUND_ERR :
                console.log("FileError.NOT_FOUND_ERR");
                break;
            case FileError.SECURITY_ERR :
                console.log("FileError.SECURITY_ERR");
                break;        
            case FileError.ABORT_ERR :
                console.log("FileError.ABORT_ERR");
                break;        
            case FileError.NOT_READABLE_ERR : 
                console.log("FileError.NOT_READABLE_ERR");
                break;        
            case FileError.ENCODING_ERR :
                console.log("FileError.ENCODING_ERR");
                break;        
            case FileError.NO_MODIFICATION_ALLOWED_ERR :
                console.log("FileError.NO_MODIFICATION_ALLOWED_ERR");
                break;        
            case FileError.INVALID_STATE_ERR :
                console.log("FileError.INVALID_STATE_ERR");
                break;        
            case FileError.SYNTAX_ERR :
                console.log("FileError.SYNTAX_ERR");
                break;        
            case FileError.INVALID_MODIFICATION_ERR :
                console.log("FileError.INVALID_MODIFICATION_ERR");
                break;        
            case FileError.QUOTA_EXCEEDED_ERR :
                console.log("FileError.QUOTA_EXCEEDED_ERR");
                break;        
            case FileError.TYPE_MISMATCH_ERR :
                console.log("FileError.TYPE_MISMATCH_ERR");
                break;        
            case FileError.PATH_EXISTS_ERR :
                console.log("FileError.PATH_EXISTS_ERR");
                break;
        }
    }
    ```
      


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message