Skip to content

Commit 77b797b

Browse files
committed
remove unnecessary catch after sendRpcResolve
1 parent a1f2825 commit 77b797b

3 files changed

Lines changed: 2 additions & 48 deletions

File tree

lib/js/src/manager/SystemCapabilityManager.js

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ class SystemCapabilityManager extends _SubManagerBase {
471471

472472
/**
473473
* Sends a request to core for the capability, instead of checking cached capabilities
474-
* @deprecated since version 1.1. Use sendRpcResolve instead
475474
* @param {SystemCapabilityType} systemCapabilityType - A SystemCapabilityType enum value.
476475
* @returns {Promise} - Promise returning either the capability Object or null if not found
477476
*/
@@ -511,47 +510,6 @@ class SystemCapabilityManager extends _SubManagerBase {
511510
return this.getCapability(systemCapabilityType, retrievedCapability);
512511
}
513512

514-
/**
515-
* Sends a request to core for the capability, instead of checking cached capabilities
516-
* @param {SystemCapabilityType} systemCapabilityType - A SystemCapabilityType enum value.
517-
* @returns {Promise} - Promise returning either the capability Object or null if not found
518-
*/
519-
async updateCapabilityResolve (systemCapabilityType) {
520-
// don't bother getting a capability if it isn't queryable
521-
const getCapabilityMethodName = this._getCapabilityMethodForType(systemCapabilityType);
522-
if (getCapabilityMethodName === null) {
523-
console.error(`The systemCapabilityType ${systemCapabilityType} cannot be queried for`);
524-
return null;
525-
}
526-
527-
const request = new GetSystemCapability()
528-
.setSystemCapabilityType(systemCapabilityType);
529-
530-
if (this._lifecycleManager === null) {
531-
return null;
532-
}
533-
534-
const response = await this._lifecycleManager.sendRpcResolve(request)
535-
.catch(err => {
536-
if (err instanceof RpcResponse) {
537-
console.error(`GetSystemCapability for type ${systemCapabilityType} returned with response code ${err.getResultCode()}`);
538-
} else {
539-
console.error(new Error(err));
540-
}
541-
return null;
542-
});
543-
544-
if (response === null) {
545-
return null;
546-
}
547-
548-
// invoke the correct get capability method
549-
const retrievedCapability = response.getSystemCapability()[getCapabilityMethodName]();
550-
this._setCapability(systemCapabilityType, retrievedCapability);
551-
// get the capability back through this method, because it may have changed the output
552-
return this.getCapability(systemCapabilityType, retrievedCapability);
553-
}
554-
555513
/**
556514
* Add an OnSystemCapabilityListener function.
557515
* @param {SystemCapabilityType} systemCapabilityType - A SystemCapabilityType enum value.

lib/js/src/manager/lifecycle/_LifecycleManager.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,7 @@ class _LifecycleManager {
109109

110110
if (serviceType === _ServiceType.RPC) {
111111
if (this._lifecycleConfig !== null && this._lifecycleConfig !== undefined) {
112-
this.sendRpcResolve(this._createRegisterAppInterface())
113-
.catch(() => {
114-
// avoids uncaught error
115-
});
112+
this.sendRpcResolve(this._createRegisterAppInterface());
116113
}
117114
}
118115
});

lib/js/src/manager/screen/_SoftButtonManagerBase.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,7 @@ class _SoftButtonManagerBase extends _SubManagerBase {
318318
show.setSoftButtons(this._createSoftButtonsForCurrentState());
319319
}
320320

321-
const response = await this._lifecycleManager.sendRpcResolve(show)
322-
.catch(err => err);
321+
const response = await this._lifecycleManager.sendRpcResolve(show);
323322

324323
if (!response.getSuccess()) {
325324
console.error(response);

0 commit comments

Comments
 (0)