mirror of https://github.com/OpenVidu/openvidu.git
openvidu-node-client: Updated rejected responses and dependencies
Old promises rejections return unusable responses to the client. Now they return the status codepull/730/head
parent
75f4c6497f
commit
df7bd5f202
File diff suppressed because it is too large
Load Diff
|
@ -1,37 +1,37 @@
|
|||
{
|
||||
"author": "OpenVidu",
|
||||
"author": "OpenVidu",
|
||||
"dependencies": {
|
||||
"axios": "0.21.4",
|
||||
"axios": "0.27.2",
|
||||
"buffer": "6.0.3"
|
||||
},
|
||||
"description": "OpenVidu Node Client",
|
||||
},
|
||||
"description": "OpenVidu Node Client",
|
||||
"devDependencies": {
|
||||
"@types/node": "14.14.37",
|
||||
"grunt": "1.3.0",
|
||||
"grunt-cli": "1.4.2",
|
||||
"grunt-contrib-copy": "1.0.0",
|
||||
"grunt-contrib-sass": "2.0.0",
|
||||
"grunt-contrib-uglify": "5.0.1",
|
||||
"grunt-contrib-watch": "1.1.0",
|
||||
"grunt-postcss": "0.9.0",
|
||||
"grunt-string-replace": "1.3.1",
|
||||
"grunt-ts": "6.0.0-beta.22",
|
||||
"ts-node": "9.1.1",
|
||||
"tslint": "6.1.3",
|
||||
"typedoc": "0.19.2",
|
||||
"typescript": "3.8.3"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"main": "lib/index.js",
|
||||
"name": "openvidu-node-client",
|
||||
"@types/node": "17.0.35",
|
||||
"grunt": "1.5.3",
|
||||
"grunt-cli": "1.4.3",
|
||||
"grunt-contrib-copy": "1.0.0",
|
||||
"grunt-contrib-sass": "2.0.0",
|
||||
"grunt-contrib-uglify": "5.2.1",
|
||||
"grunt-contrib-watch": "1.1.0",
|
||||
"grunt-postcss": "0.9.0",
|
||||
"grunt-string-replace": "1.3.1",
|
||||
"grunt-ts": "6.0.0-beta.22",
|
||||
"ts-node": "10.8.0",
|
||||
"tslint": "6.1.3",
|
||||
"typedoc": "0.22.15",
|
||||
"typescript": "4.0.8"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"main": "lib/index.js",
|
||||
"name": "openvidu-node-client",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"type": "git",
|
||||
"url": "git://github.com/OpenVidu/openvidu"
|
||||
},
|
||||
},
|
||||
"scripts": {
|
||||
"build": "./node_modules/typescript/bin/tsc",
|
||||
"build": "./node_modules/typescript/bin/tsc",
|
||||
"docs": "./generate-docs.sh"
|
||||
},
|
||||
"typings": "lib/index.d.ts",
|
||||
},
|
||||
"typings": "lib/index.d.ts",
|
||||
"version": "2.22.0"
|
||||
}
|
|
@ -89,7 +89,7 @@ export class OpenVidu {
|
|||
/**
|
||||
* @param hostname URL where your instance of OpenVidu Server is up an running.
|
||||
* It must be the full URL (e.g. `https://12.34.56.78:1234/`)
|
||||
*
|
||||
*
|
||||
* @param secret Secret used on OpenVidu Server initialization
|
||||
*/
|
||||
constructor(private hostname: string, secret: string) {
|
||||
|
@ -101,9 +101,9 @@ export class OpenVidu {
|
|||
* Creates an OpenVidu session. The session identifier will be available at property [[Session.sessionId]]
|
||||
*
|
||||
* @returns A Promise that is resolved to the [[Session]] if success and rejected with an Error object if not.
|
||||
* This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* (see [REST API](/en/stable/reference-docs/REST-API/#post-recording-start)).
|
||||
*
|
||||
*
|
||||
* This method will never return an Error with status `409`. If a session with the same `customSessionId` already
|
||||
* exists in OpenVidu Server, a [[Session.fetch]] operation is performed in the background and the updated Session
|
||||
* object is returned.
|
||||
|
@ -134,7 +134,7 @@ export class OpenVidu {
|
|||
* @param properties Custom RecordingProperties to apply to this Recording. This will override the global default values set to the Session with [[SessionProperties.defaultRecordingProperties]]
|
||||
*
|
||||
* @returns A Promise that is resolved to the [[Recording]] if it successfully started (the recording can be stopped with guarantees) and rejected with an Error
|
||||
* object if not. This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* object if not. This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* (see [REST API](/en/stable/reference-docs/REST-API/#post-recording-start)).
|
||||
*/
|
||||
public startRecording(sessionId: string, param2?: string | RecordingProperties): Promise<Recording> {
|
||||
|
@ -196,7 +196,7 @@ export class OpenVidu {
|
|||
resolve(r);
|
||||
} else {
|
||||
// ERROR response from openvidu-server. Resolve HTTP status
|
||||
reject(new Error(res.status.toString()));
|
||||
reject(res.status);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.handleError(error, reject);
|
||||
|
@ -210,7 +210,7 @@ export class OpenVidu {
|
|||
* @param recordingId The `id` property of the [[Recording]] you want to stop
|
||||
*
|
||||
* @returns A Promise that is resolved to the [[Recording]] if it successfully stopped and rejected with an Error object if not.
|
||||
* This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* (see [REST API](/en/stable/reference-docs/REST-API/#post-recording-stop)).
|
||||
*/
|
||||
public stopRecording(recordingId: string): Promise<Recording> {
|
||||
|
@ -239,7 +239,7 @@ export class OpenVidu {
|
|||
resolve(r);
|
||||
} else {
|
||||
// ERROR response from openvidu-server. Resolve HTTP status
|
||||
reject(new Error(res.status.toString()));
|
||||
reject(res.status);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.handleError(error, reject);
|
||||
|
@ -253,7 +253,7 @@ export class OpenVidu {
|
|||
* @param recordingId The `id` property of the [[Recording]] you want to retrieve
|
||||
*
|
||||
* @returns A Promise that is resolved to the [[Recording]] if it successfully stopped and rejected with an Error object if not.
|
||||
* This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* (see [REST API](/en/stable/reference-docs/REST-API/#get-recording)).
|
||||
*/
|
||||
public getRecording(recordingId: string): Promise<Recording> {
|
||||
|
@ -274,7 +274,7 @@ export class OpenVidu {
|
|||
resolve(new Recording(res.data));
|
||||
} else {
|
||||
// ERROR response from openvidu-server. Resolve HTTP status
|
||||
reject(new Error(res.status.toString()));
|
||||
reject(res.status);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.handleError(error, reject);
|
||||
|
@ -311,7 +311,7 @@ export class OpenVidu {
|
|||
resolve(recordingArray);
|
||||
} else {
|
||||
// ERROR response from openvidu-server. Resolve HTTP status
|
||||
reject(new Error(res.status.toString()));
|
||||
reject(res.status);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.handleError(error, reject);
|
||||
|
@ -325,7 +325,7 @@ export class OpenVidu {
|
|||
* @param recordingId
|
||||
*
|
||||
* @returns A Promise that is resolved if the Recording was successfully deleted and rejected with an Error object if not.
|
||||
* This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* This Error object has as `message` property with a status code carrying a specific meaning
|
||||
* (see [REST API](/en/stable/reference-docs/REST-API/#delete-recording)).
|
||||
*/
|
||||
public deleteRecording(recordingId: string): Promise<Error> {
|
||||
|
@ -346,7 +346,7 @@ export class OpenVidu {
|
|||
resolve(undefined);
|
||||
} else {
|
||||
// ERROR response from openvidu-server. Resolve HTTP status
|
||||
reject(new Error(res.status.toString()));
|
||||
reject(res.status);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.handleError(error, reject);
|
||||
|
@ -416,7 +416,7 @@ export class OpenVidu {
|
|||
resolve(hasChanged);
|
||||
} else {
|
||||
// ERROR response from openvidu-server. Resolve HTTP status
|
||||
reject(new Error(res.status.toString()));
|
||||
reject(res.status);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.handleError(error, reject);
|
||||
|
@ -573,7 +573,7 @@ export class OpenVidu {
|
|||
resolve({ changes: globalChanges, sessionChanges });
|
||||
} else {
|
||||
// ERROR response from openvidu-server. Resolve HTTP status
|
||||
reject(new Error(res.status.toString()));
|
||||
reject(res.status);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.handleError(error, reject);
|
||||
|
@ -602,15 +602,15 @@ export class OpenVidu {
|
|||
handleError(error: AxiosError, reject: (reason?: any) => void) {
|
||||
if (error.response) {
|
||||
// The request was made and the server responded with a status code (not 2xx)
|
||||
reject(new Error(error.response.status.toString()));
|
||||
reject(error.response.status);
|
||||
} else if (error.request) {
|
||||
// The request was made but no response was received
|
||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
||||
// http.ClientRequest in node.js
|
||||
reject(new Error(error.request));
|
||||
reject(error.request);
|
||||
} else {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
reject(new Error(error.message));
|
||||
reject(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue