diff --git a/frontend-js/src/main/js/InvalidArgumentError.js b/frontend-js/src/main/js/InvalidArgumentError.js
index 1c4f45fc9850a6421392236a5fa7e28483fffae2..2e8fb4c330b614e4710c8022dd2c5867d8be7281 100644
--- a/frontend-js/src/main/js/InvalidArgumentError.js
+++ b/frontend-js/src/main/js/InvalidArgumentError.js
@@ -5,11 +5,11 @@
 var logger = require('./logger');
 
 function InvalidArgumentError(message) {
-  this.name = "InvalidArgumentError";
   this.message = message;
   this.stack = (new Error()).stack;
 }
 
-InvalidArgumentError.prototype = new Error
+InvalidArgumentError.prototype = Object.create(Error.prototype);
+InvalidArgumentError.prototype.constructor = InvalidArgumentError;
 
 module.exports = InvalidArgumentError;
diff --git a/frontend-js/src/main/js/InvalidCredentialsError.js b/frontend-js/src/main/js/InvalidCredentialsError.js
index f0de8ad8313582137435553e901efc3c60ebf3db..5e62dda849d3639f127255ed73095220482ba44b 100644
--- a/frontend-js/src/main/js/InvalidCredentialsError.js
+++ b/frontend-js/src/main/js/InvalidCredentialsError.js
@@ -5,11 +5,11 @@
 var logger = require('./logger');
 
 function InvalidCredentialsError(message) {
-  this.name = "InvalidCredentialsError";
   this.message = message;
   this.stack = (new Error()).stack;
 }
 
-InvalidCredentialsError.prototype = new Error
+InvalidCredentialsError.prototype = Object.create(Error.prototype);
+InvalidCredentialsError.prototype.constructor = InvalidCredentialsError;
 
 module.exports = InvalidCredentialsError;