From 5c3c3950d52b61e9239f4e02f22001d490abe709 Mon Sep 17 00:00:00 2001 From: yann300 Date: Sat, 26 Oct 2024 22:43:04 +0200 Subject: [PATCH] show error in the terminal and don't switch away --- .../src/app/providers/abstract-provider.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide/src/app/providers/abstract-provider.tsx b/apps/remix-ide/src/app/providers/abstract-provider.tsx index b00efc3d0a..e41c331217 100644 --- a/apps/remix-ide/src/app/providers/abstract-provider.tsx +++ b/apps/remix-ide/src/app/providers/abstract-provider.tsx @@ -107,19 +107,13 @@ export abstract class AbstractProvider extends Plugin implements IProvider { }) } - private async switchAway(showError) { + private async switchAway(showError: boolean, msg: string) { if (!this.provider) return this.provider = null this.connected = false if (showError) { - const modalContent: AlertModal = { - id: this.profile.name, - title: this.profile.displayName, - message: `Error while connecting to the provider, provider not connected` - } - this.call('notification', 'alert', modalContent) + this.call('notification', 'toast', 'Error while querying the provider: ' + msg) } - await this.call('udapp', 'setEnvironmentMode', { context: 'vm-cancun' }) return } @@ -130,7 +124,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider { resolve({ jsonrpc: '2.0', result, id: data.id }) } catch (error) { if (error && error.message && error.message.includes('SERVER_ERROR')) { - this.switchAway(true) + this.switchAway(true, error.message) } error.code = -32603 reject({ jsonrpc: '2.0', error, id: data.id })