glitch-javascript-sdk 0.1.2 → 0.1.3

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/dist/cjs/index.js CHANGED
@@ -17248,6 +17248,29 @@ var Waitlists = /** @class */ (function () {
17248
17248
  return Waitlists;
17249
17249
  }());
17250
17250
 
17251
+ var Parser = /** @class */ (function () {
17252
+ function Parser() {
17253
+ }
17254
+ /**
17255
+ * To be used inside a catch close, this function will parse out any JSON in a error response from the api.
17256
+ *
17257
+ * @param error The Error object from the catch clause
17258
+ *
17259
+ * @returns Either returns a JSON object or false.
17260
+ */
17261
+ Parser.parseJSONFromError = function (error) {
17262
+ var errorString = error.toString();
17263
+ errorString = errorString.replace('Error: ', '');
17264
+ try {
17265
+ return JSON.parse(errorString);
17266
+ }
17267
+ catch (e) {
17268
+ return false;
17269
+ }
17270
+ };
17271
+ return Parser;
17272
+ }());
17273
+
17251
17274
  //Configuration
17252
17275
  var Glitch = /** @class */ (function () {
17253
17276
  function Glitch() {
@@ -17263,6 +17286,10 @@ var Glitch = /** @class */ (function () {
17263
17286
  Teams: Teams,
17264
17287
  Waitlists: Waitlists
17265
17288
  };
17289
+ Glitch.util = {
17290
+ Requests: Requests,
17291
+ Parser: Parser
17292
+ };
17266
17293
  return Glitch;
17267
17294
  }());
17268
17295