Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /ai/language-model/language-model-prompt-monitor-callback-exception.tentative.https.window.html - WPT Dashboard Interop Dashboard
// META: title=Language Model Prompt Monitor Callback Exception
// META: script=/resources/testdriver.js
// META: script=../resources/util.js
// META: timeout=long
'use strict';
// Test that the exception from the callback will be re-thrown by the session
// creation, and the session won't be created.
promise_test(async t => {
// Make sure the model availability is `downloadable`.
const availability = await LanguageModel.availability();
if (availability === "downloadable") {
const error = new Error("test");
const sessionPromise = createLanguageModel({
// Start a new session with callback that will throw error.
monitor(m) {
throw error;
}
});
await promise_rejects_exactly(
t, error, sessionPromise
);
}
});