mirror of https://github.com/OpenVidu/openvidu.git
Revert "openvidu-node-client: Updated rejected responses"
This reverts commit df7bd5f202
.
pull/731/head
parent
f0f5f217bb
commit
2785d3c036
|
@ -89,7 +89,7 @@ export class OpenVidu {
|
||||||
/**
|
/**
|
||||||
* @param hostname URL where your instance of OpenVidu Server is up an running.
|
* @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/`)
|
* It must be the full URL (e.g. `https://12.34.56.78:1234/`)
|
||||||
*
|
*
|
||||||
* @param secret Secret used on OpenVidu Server initialization
|
* @param secret Secret used on OpenVidu Server initialization
|
||||||
*/
|
*/
|
||||||
constructor(private hostname: string, secret: string) {
|
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]]
|
* 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.
|
* @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)).
|
* (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
|
* 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
|
* exists in OpenVidu Server, a [[Session.fetch]] operation is performed in the background and the updated Session
|
||||||
* object is returned.
|
* 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]]
|
* @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
|
* @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)).
|
* (see [REST API](/en/stable/reference-docs/REST-API/#post-recording-start)).
|
||||||
*/
|
*/
|
||||||
public startRecording(sessionId: string, param2?: string | RecordingProperties): Promise<Recording> {
|
public startRecording(sessionId: string, param2?: string | RecordingProperties): Promise<Recording> {
|
||||||
|
@ -196,7 +196,7 @@ export class OpenVidu {
|
||||||
resolve(r);
|
resolve(r);
|
||||||
} else {
|
} else {
|
||||||
// ERROR response from openvidu-server. Resolve HTTP status
|
// ERROR response from openvidu-server. Resolve HTTP status
|
||||||
reject(res.status);
|
reject(new Error(res.status.toString()));
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.handleError(error, reject);
|
this.handleError(error, reject);
|
||||||
|
@ -210,7 +210,7 @@ export class OpenVidu {
|
||||||
* @param recordingId The `id` property of the [[Recording]] you want to stop
|
* @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.
|
* @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)).
|
* (see [REST API](/en/stable/reference-docs/REST-API/#post-recording-stop)).
|
||||||
*/
|
*/
|
||||||
public stopRecording(recordingId: string): Promise<Recording> {
|
public stopRecording(recordingId: string): Promise<Recording> {
|
||||||
|
@ -239,7 +239,7 @@ export class OpenVidu {
|
||||||
resolve(r);
|
resolve(r);
|
||||||
} else {
|
} else {
|
||||||
// ERROR response from openvidu-server. Resolve HTTP status
|
// ERROR response from openvidu-server. Resolve HTTP status
|
||||||
reject(res.status);
|
reject(new Error(res.status.toString()));
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.handleError(error, reject);
|
this.handleError(error, reject);
|
||||||
|
@ -253,7 +253,7 @@ export class OpenVidu {
|
||||||
* @param recordingId The `id` property of the [[Recording]] you want to retrieve
|
* @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.
|
* @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)).
|
* (see [REST API](/en/stable/reference-docs/REST-API/#get-recording)).
|
||||||
*/
|
*/
|
||||||
public getRecording(recordingId: string): Promise<Recording> {
|
public getRecording(recordingId: string): Promise<Recording> {
|
||||||
|
@ -274,7 +274,7 @@ export class OpenVidu {
|
||||||
resolve(new Recording(res.data));
|
resolve(new Recording(res.data));
|
||||||
} else {
|
} else {
|
||||||
// ERROR response from openvidu-server. Resolve HTTP status
|
// ERROR response from openvidu-server. Resolve HTTP status
|
||||||
reject(res.status);
|
reject(new Error(res.status.toString()));
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.handleError(error, reject);
|
this.handleError(error, reject);
|
||||||
|
@ -311,7 +311,7 @@ export class OpenVidu {
|
||||||
resolve(recordingArray);
|
resolve(recordingArray);
|
||||||
} else {
|
} else {
|
||||||
// ERROR response from openvidu-server. Resolve HTTP status
|
// ERROR response from openvidu-server. Resolve HTTP status
|
||||||
reject(res.status);
|
reject(new Error(res.status.toString()));
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.handleError(error, reject);
|
this.handleError(error, reject);
|
||||||
|
@ -325,7 +325,7 @@ export class OpenVidu {
|
||||||
* @param recordingId
|
* @param recordingId
|
||||||
*
|
*
|
||||||
* @returns A Promise that is resolved if the Recording was successfully deleted and rejected with an Error object if not.
|
* @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)).
|
* (see [REST API](/en/stable/reference-docs/REST-API/#delete-recording)).
|
||||||
*/
|
*/
|
||||||
public deleteRecording(recordingId: string): Promise<Error> {
|
public deleteRecording(recordingId: string): Promise<Error> {
|
||||||
|
@ -346,7 +346,7 @@ export class OpenVidu {
|
||||||
resolve(undefined);
|
resolve(undefined);
|
||||||
} else {
|
} else {
|
||||||
// ERROR response from openvidu-server. Resolve HTTP status
|
// ERROR response from openvidu-server. Resolve HTTP status
|
||||||
reject(res.status);
|
reject(new Error(res.status.toString()));
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.handleError(error, reject);
|
this.handleError(error, reject);
|
||||||
|
@ -416,7 +416,7 @@ export class OpenVidu {
|
||||||
resolve(hasChanged);
|
resolve(hasChanged);
|
||||||
} else {
|
} else {
|
||||||
// ERROR response from openvidu-server. Resolve HTTP status
|
// ERROR response from openvidu-server. Resolve HTTP status
|
||||||
reject(res.status);
|
reject(new Error(res.status.toString()));
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.handleError(error, reject);
|
this.handleError(error, reject);
|
||||||
|
@ -573,7 +573,7 @@ export class OpenVidu {
|
||||||
resolve({ changes: globalChanges, sessionChanges });
|
resolve({ changes: globalChanges, sessionChanges });
|
||||||
} else {
|
} else {
|
||||||
// ERROR response from openvidu-server. Resolve HTTP status
|
// ERROR response from openvidu-server. Resolve HTTP status
|
||||||
reject(res.status);
|
reject(new Error(res.status.toString()));
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.handleError(error, reject);
|
this.handleError(error, reject);
|
||||||
|
@ -602,15 +602,15 @@ export class OpenVidu {
|
||||||
handleError(error: AxiosError, reject: (reason?: any) => void) {
|
handleError(error: AxiosError, reject: (reason?: any) => void) {
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
// The request was made and the server responded with a status code (not 2xx)
|
// The request was made and the server responded with a status code (not 2xx)
|
||||||
reject(error.response.status);
|
reject(new Error(error.response.status.toString()));
|
||||||
} else if (error.request) {
|
} else if (error.request) {
|
||||||
// The request was made but no response was received
|
// The request was made but no response was received
|
||||||
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
|
||||||
// http.ClientRequest in node.js
|
// http.ClientRequest in node.js
|
||||||
reject(error.request);
|
reject(new Error(error.request));
|
||||||
} else {
|
} else {
|
||||||
// Something happened in setting up the request that triggered an Error
|
// Something happened in setting up the request that triggered an Error
|
||||||
reject(error.message);
|
reject(new Error(error.message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue