Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-12433

Make FileError extends native Error

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: cordova-plugin-file
    • Labels:
      None

      Description

      diff --git a/www/FileError.js b/www/FileError.js
      index 6507921..eb681d6 100644
      --- a/www/FileError.js
      +++ b/www/FileError.js
      @@ -24,8 +24,17 @@
        */
       function FileError(error) {
         this.code = error || null;
      +
      +  this.name = this.constructor.name;
      +  if (typeof Error.captureStackTrace === 'function') {
      +    Error.captureStackTrace(this, this.constructor);
      +  } else {
      +    this.stack = (new Error(error)).stack;
      +  }
       }
      
      +FileError.prototype = new Error();
      +
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dolezel Jan Dole┼żel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: