refactor: throw an error when removing a non-existing plugin

Related to #2
This commit is contained in:
Jovan Krunić
2019-07-05 15:25:42 +02:00
committed by Rainer Killinger
parent 992a0a6f2c
commit 3ea2c3b98d
3 changed files with 11 additions and 16 deletions

View File

@@ -14,6 +14,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {
SCNotFoundErrorResponse,
SCPluginAlreadyRegisteredErrorResponse,
SCPluginMetaData,
SCPluginRegisterRequest,
@@ -85,11 +86,9 @@ function addPlugin(plugin: SCPluginMetaData): SCPluginRegisterResponse {
*/
function removePlugin(route: string): SCPluginRegisterResponse {
if (!plugins.has(route)) {
// TODO: throw error when plugin that is to be removed is not already registered (after @openstapps/core update)
// throw new SCNotFoundErrorResponse(
// isTestEnvironment,
// );
return {success: false};
throw new SCNotFoundErrorResponse(
isTestEnvironment,
);
}
// remove the plugin information using its route as a key
plugins.delete(route);