pull/5343/head
bunsenstraat 3 weeks ago committed by Aniket
parent 5f9ac0483a
commit 876f381926
  1. 16
      apps/remix-ide/src/app/providers/abstract-provider.tsx

@ -124,7 +124,21 @@ 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, error.message)
try {
// replace escaped quotes with normal quotes
const errorString = String(error.message).replace(/\\"/g, '"');
const messageMatches = Array.from(errorString.matchAll(/"message":"(.*?)"/g));
// Extract the message values
const messages = messageMatches.map(match => match[1]);
if (messages && messages.length > 0) {
this.switchAway(true, messages[0])
} else {
this.switchAway(true, error.message ? error.message : error.error ? error.error : error)
}
} catch (error) {
this.switchAway(true, error.message ? error.message : error.error ? error.error : error)
}
}
error.code = -32603
reject({ jsonrpc: '2.0', error, id: data.id })

Loading…
Cancel
Save