screenshotone-api-sdk 1.1.18 → 1.1.19
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/main.js +5 -2
- package/package.json +1 -1
- package/src/main.ts +24 -12
package/dist/main.js
CHANGED
|
@@ -82,9 +82,12 @@ class Client {
|
|
|
82
82
|
}
|
|
83
83
|
try {
|
|
84
84
|
const data = await response.json();
|
|
85
|
-
throw new
|
|
85
|
+
throw new errors_1.default(`Failed to generate screenshot, response returned ${response.status} (${response.statusText}): ${data?.error_message}`, response.status, data?.error_code, data?.error_message, data?.documentation_url);
|
|
86
86
|
}
|
|
87
87
|
catch (e) {
|
|
88
|
+
if (e instanceof errors_1.default) {
|
|
89
|
+
throw e;
|
|
90
|
+
}
|
|
88
91
|
throw new Error(`failed to take screenshot, response returned ${response.status} ${response.statusText}`);
|
|
89
92
|
}
|
|
90
93
|
}
|
|
@@ -145,7 +148,7 @@ class Client {
|
|
|
145
148
|
};
|
|
146
149
|
}
|
|
147
150
|
const data = await response.json();
|
|
148
|
-
throw new
|
|
151
|
+
throw new errors_1.default(`Failed to generate animation, response returned ${response.status} (${response.statusText}): ${data?.error_message}`, response.status, data?.error_code, data?.error_message, data?.documentation_url);
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
154
|
exports.Client = Client;
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -97,10 +97,18 @@ export class Client {
|
|
|
97
97
|
try {
|
|
98
98
|
const data = await response.json();
|
|
99
99
|
|
|
100
|
-
throw new
|
|
101
|
-
`
|
|
100
|
+
throw new APIError(
|
|
101
|
+
`Failed to generate screenshot, response returned ${response.status} (${response.statusText}): ${data?.error_message}`,
|
|
102
|
+
response.status,
|
|
103
|
+
data?.error_code,
|
|
104
|
+
data?.error_message,
|
|
105
|
+
data?.documentation_url
|
|
102
106
|
);
|
|
103
107
|
} catch (e) {
|
|
108
|
+
if (e instanceof APIError) {
|
|
109
|
+
throw e;
|
|
110
|
+
}
|
|
111
|
+
|
|
104
112
|
throw new Error(
|
|
105
113
|
`failed to take screenshot, response returned ${response.status} ${response.statusText}`
|
|
106
114
|
);
|
|
@@ -129,7 +137,7 @@ export class Client {
|
|
|
129
137
|
data?.error_code,
|
|
130
138
|
data?.error_message,
|
|
131
139
|
data?.documentation_url
|
|
132
|
-
);
|
|
140
|
+
);
|
|
133
141
|
} catch (e) {
|
|
134
142
|
if (e instanceof APIError) {
|
|
135
143
|
throw e;
|
|
@@ -189,8 +197,12 @@ export class Client {
|
|
|
189
197
|
|
|
190
198
|
const data = await response.json();
|
|
191
199
|
|
|
192
|
-
throw new
|
|
193
|
-
`
|
|
200
|
+
throw new APIError(
|
|
201
|
+
`Failed to generate animation, response returned ${response.status} (${response.statusText}): ${data?.error_message}`,
|
|
202
|
+
response.status,
|
|
203
|
+
data?.error_code,
|
|
204
|
+
data?.error_message,
|
|
205
|
+
data?.documentation_url
|
|
194
206
|
);
|
|
195
207
|
}
|
|
196
208
|
}
|
|
@@ -392,7 +404,6 @@ export class TakeOptions {
|
|
|
392
404
|
return this;
|
|
393
405
|
}
|
|
394
406
|
|
|
395
|
-
|
|
396
407
|
/**
|
|
397
408
|
* Set `true` to scroll the page to the bottom.
|
|
398
409
|
*/
|
|
@@ -1018,7 +1029,10 @@ export class TakeOptions {
|
|
|
1018
1029
|
* Sets whether to include HTTP response status code metadata.
|
|
1019
1030
|
*/
|
|
1020
1031
|
metadataHttpResponseStatusCode(include: boolean): TakeOptions {
|
|
1021
|
-
this.put(
|
|
1032
|
+
this.put(
|
|
1033
|
+
"metadata_http_response_status_code",
|
|
1034
|
+
include ? "true" : "false"
|
|
1035
|
+
);
|
|
1022
1036
|
|
|
1023
1037
|
return this;
|
|
1024
1038
|
}
|
|
@@ -1073,7 +1087,7 @@ export class TakeOptions {
|
|
|
1073
1087
|
*/
|
|
1074
1088
|
failIfGpuRenderingFails(fail: boolean): TakeOptions {
|
|
1075
1089
|
this.put("fail_if_gpu_rendering_fails", fail ? "true" : "false");
|
|
1076
|
-
|
|
1090
|
+
|
|
1077
1091
|
return this;
|
|
1078
1092
|
}
|
|
1079
1093
|
|
|
@@ -1625,7 +1639,7 @@ export class AnimateOptions {
|
|
|
1625
1639
|
|
|
1626
1640
|
scrollBack(scrollBack: boolean): AnimateOptions {
|
|
1627
1641
|
this.put("scroll_back", scrollBack ? "true" : "false");
|
|
1628
|
-
|
|
1642
|
+
|
|
1629
1643
|
return this;
|
|
1630
1644
|
}
|
|
1631
1645
|
|
|
@@ -1673,7 +1687,7 @@ export class AnimateOptions {
|
|
|
1673
1687
|
*/
|
|
1674
1688
|
requestGpuRendering(request: boolean): AnimateOptions {
|
|
1675
1689
|
this.put("request_gpu_rendering", request ? "true" : "false");
|
|
1676
|
-
|
|
1690
|
+
|
|
1677
1691
|
return this;
|
|
1678
1692
|
}
|
|
1679
1693
|
|
|
@@ -1749,7 +1763,6 @@ export class AnimateOptions {
|
|
|
1749
1763
|
return this;
|
|
1750
1764
|
}
|
|
1751
1765
|
|
|
1752
|
-
|
|
1753
1766
|
/**
|
|
1754
1767
|
* Sets the width of the animation.
|
|
1755
1768
|
*/
|
|
@@ -1839,7 +1852,6 @@ export class AnimateOptions {
|
|
|
1839
1852
|
return this;
|
|
1840
1853
|
}
|
|
1841
1854
|
|
|
1842
|
-
|
|
1843
1855
|
toQuery(): URLSearchParams {
|
|
1844
1856
|
return new URLSearchParams(this.query.toString());
|
|
1845
1857
|
}
|