blob: dc24c2f8d1dab8d7747a9b90e15463f3617c4863 [file] [log] [blame]
<!doctype html>
<title>Scheduling API: Task.result When a Task Throws an Error</title>
<link rel="author" title="Scott Haseley" href="mailto:shaseley@chromium.org">
<link rel="help" href="https://github.com/WICG/main-thread-scheduling">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
async_test(t => {
(function() {
let task_promise = scheduler.postTask(() => { throw Error('Failed'); });
task_promise.then(t.step_func((res) => {
assert_true(false, 'task promise should not be fulfilled when the task throws an error.');
}))
.catch(t.step_func_done((e) => {
assert_equals(e.name, 'Error');
assert_equals(e.message, 'Failed');
}));
})();
}, 'Test task promise is rejected properly when the task throws an error');
</script>