Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lokalise/node-api

Package Overview
Dependencies
Maintainers
2
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lokalise/node-api - npm Package Compare versions

Comparing version 1.5.0-rc1 to 2.0.0

dist/interfaces/api_error.js

7

CHANGELOG.md
# Lokalise API Node Client Changelog
## 1.5.0
## 2.0.0 (05-Dec-19)
* Added [error handling mechanism](https://github.com/lokalise/node-lokalise-api#error-handling)
* Updated dependencies
## 1.5.0-rc.1 (04-Dec-19)
* Set `noImplicitAny` and `strictNullChecks` to `true` in `tsconfig.json`

@@ -6,0 +11,0 @@ * Fixed errors related to the options above

6

dist/collections/base_collection.js

@@ -43,2 +43,5 @@ "use strict";

}
populateApiErrorFromJson(json) {
return json;
}
returnBareJSON(json) {

@@ -48,4 +51,3 @@ return json;

handleReject(data) {
console.log(data);
return;
return this.populateApiErrorFromJson(data);
}

@@ -52,0 +54,0 @@ createPromise(method, params, resolveFn, rejectFn = this.handleReject, body = null, uri = null) {

{
"name": "@lokalise/node-api",
"version": "1.5.0-rc1",
"version": "2.0.0",
"description": "Official Lokalise API 2.0 Node.js client",

@@ -40,3 +40,3 @@ "license": "MIT",

"request": "^2.88.0",
"typescript": "^3.7.2"
"typescript": "^3.7.3"
},

@@ -43,0 +43,0 @@ "bugs": {

@@ -884,2 +884,12 @@ # Lokalise API v2 official Node.js client

To handle request errors, you may use the following approach:
```js
lokaliseApi.projects.list().catch(
(e) => {
console.log(e);
}
);
```
[Error codes](https://lokalise.com/api2docs/curl/#resource-errors) are listed in the API docs.

@@ -886,0 +896,0 @@

import { ApiRequest } from '../http_client/base';
import { StandartParams } from '../interfaces/standart_params';
import { ApiError } from '../models/api_error';

@@ -57,9 +58,12 @@ export class BaseCollection {

protected returnBareJSON(json: any) : any {
protected populateApiErrorFromJson(json: Object): ApiError {
return <ApiError>json;
}
protected returnBareJSON(json: any): any {
return json;
}
protected handleReject(data: any) {
console.log(data);
return;
protected handleReject(data: any): ApiError {
return this.populateApiErrorFromJson(data);
}

@@ -66,0 +70,0 @@

@@ -0,1 +1,3 @@

import {ApiError} from "../../src/interfaces/api_error";
require('../setup');

@@ -12,2 +14,10 @@ import { expect } from 'chai';

deck.createTest('error', async () => {
const error = await lokaliseApi.branches.create({
"name": "hotfix/really-important"
}, { project_id: "803" }).catch((e: ApiError) => {
expect(e.code).to.equal(401);
});
}).register(this);
deck.createTest('list', async () => {

@@ -14,0 +24,0 @@ const branches = await lokaliseApi.branches.list({project_id: project_id});

Sorry, the diff of this file is not supported yet

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