cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Doležel (JIRA) <j...@apache.org>
Subject [jira] [Updated] (CB-12433) Make FileError extends native Error
Date Tue, 07 Feb 2017 11:33:41 GMT

     [ https://issues.apache.org/jira/browse/CB-12433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jan Doležel updated CB-12433:
-----------------------------
    Description: 
{code}
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();
+
{code}

> Make FileError extends native Error
> -----------------------------------
>
>                 Key: CB-12433
>                 URL: https://issues.apache.org/jira/browse/CB-12433
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Plugin File
>            Reporter: Jan Doležel
>            Priority: Minor
>
> {code}
> 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();
> +
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message