forked from mirrors/gecko-dev
Bug 1873150 - [devtools] Throw in getPreview if evaluated expression has syntax error. r=ochameau,devtools-reviewers.
This will allow us to be notified about expression we shouldn't try to evaluate. Differential Revision: https://phabricator.services.mozilla.com/D197762
This commit is contained in:
parent
38dbc8112e
commit
662649f8d5
1 changed files with 15 additions and 3 deletions
|
|
@ -82,9 +82,21 @@ export function getPreview(target, tokenPos, editor) {
|
|||
}
|
||||
}
|
||||
|
||||
const { result } = await client.evaluate(expression, {
|
||||
frameId: selectedFrame.id,
|
||||
});
|
||||
const { result, hasException, exception } = await client.evaluate(
|
||||
expression,
|
||||
{
|
||||
frameId: selectedFrame.id,
|
||||
}
|
||||
);
|
||||
|
||||
// The evaluation shouldn't return an exception.
|
||||
if (hasException) {
|
||||
throw new Error(
|
||||
`Debugger internal exception: Preview for <${expression}> threw a ${
|
||||
exception?.getGrip()?.class || "Error"
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
const resultGrip = getGrip(result);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue