mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-10 14:25:58 +00:00
throw Error object always
This commit is contained in:
parent
b4bc50aacf
commit
9fde587211
@ -247,13 +247,16 @@ function sendRequest(command, data, host = sessionHost) {
|
||||
error = error.replace(/^[a-z]+: /i, '');
|
||||
}
|
||||
else if (error.type && error.type == 'dict') {
|
||||
let responseError = deserialize_json_value(error);
|
||||
const responseError = deserialize_json_value(error);
|
||||
let responeMessage;
|
||||
if (response.message && response.message !== '') {
|
||||
// Remove the type prefix from the error message (e.g. "Error: ").
|
||||
responseError.message = response.message.replace(/^[a-z]+: /i, '');
|
||||
responeMessage = response.message.replace(/^[a-z]+: /i, '');
|
||||
}
|
||||
|
||||
throw responseError;
|
||||
|
||||
const exceptionToReport = new Error(responeMessage);
|
||||
Object.assign(exceptionToReport, responseError);
|
||||
throw exceptionToReport;
|
||||
}
|
||||
|
||||
throw new Error(error || `Invalid response for "${command}"`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user