show error in the terminal and don't switch away

pull/5343/head
yann300 4 weeks ago committed by Aniket
parent 424863b9cd
commit 5c3c3950d5
  1. 12
      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 })

Loading…
Cancel
Save