files.com 1.0.194 → 1.0.195

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.194
1
+ 1.0.195
package/lib/Errors.js CHANGED
@@ -69,7 +69,7 @@ var errorClasses = {
69
69
  };
70
70
 
71
71
  var toPascalCase = function toPascalCase(string) {
72
- return string.replace('-', ' ').split(' ').map(function (part) {
72
+ return string.replace(/-/g, ' ').split(' ').map(function (part) {
73
73
  return part[0].toUpperCase() + part.substring(1);
74
74
  }).join('');
75
75
  };
@@ -114,9 +114,13 @@ var handleErrorResponse = function handleErrorResponse(error) {
114
114
  className = "".concat(_errorType, "Error");
115
115
  }
116
116
 
117
- var ErrorClass = errorClasses[className];
117
+ var ErrorClass = errorClasses[className] || FilesApiError;
118
118
 
119
- _Logger.default.error("".concat(className, " Exception >"), code, message);
119
+ if (!errorClasses[className]) {
120
+ _Logger.default.debug("Unable to find exception with name of ".concat(className, " - falling back to FilesApiError"));
121
+ }
122
+
123
+ _Logger.default.error("".concat(ErrorClass.name, " Exception >"), code, message);
120
124
 
121
125
  throw new ErrorClass(message, code);
122
126
  }; // general errors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.194",
3
+ "version": "1.0.195",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Errors.js CHANGED
@@ -20,7 +20,7 @@ const errorClasses = {
20
20
  }
21
21
 
22
22
  const toPascalCase = string =>
23
- string.replace('-', ' ').split(' ')
23
+ string.replace(/-/g, ' ').split(' ')
24
24
  .map(part => part[0].toUpperCase() + part.substring(1))
25
25
  .join('')
26
26
 
@@ -57,9 +57,13 @@ export const handleErrorResponse = error => {
57
57
  className = `${errorType}Error`
58
58
  }
59
59
 
60
- const ErrorClass = errorClasses[className]
60
+ const ErrorClass = errorClasses[className] || FilesApiError
61
61
 
62
- Logger.error(`${className} Exception >`, code, message)
62
+ if (!errorClasses[className]) {
63
+ Logger.debug(`Unable to find exception with name of ${className} - falling back to FilesApiError`)
64
+ }
65
+
66
+ Logger.error(`${ErrorClass.name} Exception >`, code, message)
63
67
  throw new ErrorClass(message, code)
64
68
  }
65
69