New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

screenshotone-api-sdk

Package Overview
Dependencies
Maintainers
0
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

screenshotone-api-sdk - npm Package Compare versions

Comparing version 1.1.13 to 1.1.14

dist/@types/errors.d.ts

8

dist/main.js

@@ -10,2 +10,3 @@ "use strict";

const signature_1 = require("./signature");
const errors_1 = __importDefault(require("./errors"));
const API_BASE_URL = "https://api.screenshotone.com";

@@ -104,6 +105,9 @@ const API_TAKE_PATH = "/take";

const data = await response.json();
throw new Error(`failed to generate animation, response returned ${response.status} ${response.statusText}: ${data?.error_message}`);
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);
}
catch (e) {
throw new Error(`failed to generate animation, response returned ${response.status} ${response.statusText}`);
if (e instanceof errors_1.default) {
throw e;
}
throw new Error(`Failed to generate animation, response returned ${response.status} (${response.statusText})`);
}

@@ -110,0 +114,0 @@ }

{
"name": "screenshotone-api-sdk",
"homepage": "https://screenshotone.com",
"version": "1.1.13",
"version": "1.1.14",
"description": "Use ScreenshotOne.com API to generate screenshots of any website.",

@@ -6,0 +6,0 @@ "repository": {

import Big from "big.js";
import fetch from "cross-fetch";
import { signQueryString } from "./signature";
import APIError from "./errors";

@@ -123,8 +124,16 @@ const API_BASE_URL = "https://api.screenshotone.com";

throw new Error(
`failed to generate animation, response returned ${response.status} ${response.statusText}: ${data?.error_message}`
);
throw new APIError(
`Failed to generate animation, response returned ${response.status} (${response.statusText}): ${data?.error_message}`,
response.status,
data?.error_code,
data?.error_message,
data?.documentation_url
);
} catch (e) {
if (e instanceof APIError) {
throw e;
}
throw new Error(
`failed to generate animation, response returned ${response.status} ${response.statusText}`
`Failed to generate animation, response returned ${response.status} (${response.statusText})`
);

@@ -131,0 +140,0 @@ }

@@ -0,1 +1,2 @@

import APIError from "../src/errors";
import { TakeOptions, Client, AnimateOptions } from "../src/main";

@@ -55,2 +56,23 @@

});
test("returning an API error when the response is not successful", async () => {
jest.mock('cross-fetch', () => ({
__esModule: true,
default: jest.fn().mockImplementationOnce(() =>
Promise.resolve({
ok: false,
status: 400,
statusText: "Bad Request",
json: () => Promise.resolve({
error_code: "name_not_resolved",
error_message: "Usually, the error happens when the domain name of the requested URL is not resolved. If you are trying to take a screenshot of the new site, please, wait a bit until the DNS records are refreshed.",
documentation_url: "https://screenshotone.com/docs/errors/"
})
})
)
}));
const options = AnimateOptions.url("https://example.com");
await expect(client.animate(options)).rejects.toThrow(APIError);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc