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

Make FileError extends native Error

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • cordova-plugin-file
    • 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

            Unassigned Unassigned
            dolezel Jan Doležel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: