Allow task to recover after a failed graph start
PiperOrigin-RevId: 500324587
This commit is contained in:
parent
b4ede6db7b
commit
ed0054836a
|
@ -164,6 +164,7 @@ export abstract class TaskRunner {
|
|||
|
||||
/** Throws the error from the error listener if an error was raised. */
|
||||
private handleErrors() {
|
||||
try {
|
||||
const errorCount = this.processingErrors.length;
|
||||
if (errorCount === 1) {
|
||||
// Re-throw error to get a more meaningful stacktrace
|
||||
|
@ -173,8 +174,10 @@ export abstract class TaskRunner {
|
|||
'Encountered multiple errors: ' +
|
||||
this.processingErrors.map(e => e.message).join(', '));
|
||||
}
|
||||
} finally {
|
||||
this.processingErrors = [];
|
||||
}
|
||||
}
|
||||
|
||||
/** Configures the `externalFile` option */
|
||||
private setExternalFile(modelAssetBuffer?: Uint8Array): void {
|
||||
|
|
|
@ -139,6 +139,18 @@ describe('TaskRunner', () => {
|
|||
}).toThrowError(/Test error 1, Test error 2/);
|
||||
});
|
||||
|
||||
it('clears errors once thrown', () => {
|
||||
taskRunner.enqueueError('Test error');
|
||||
|
||||
expect(() => {
|
||||
taskRunner.setGraph(new Uint8Array(0), /* isBinary= */ true);
|
||||
}).toThrowError(/Test error/);
|
||||
|
||||
expect(() => {
|
||||
taskRunner.setGraph(new Uint8Array(0), /* isBinary= */ true);
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it('verifies that at least one model asset option is provided', () => {
|
||||
expect(() => {
|
||||
taskRunner.setOptions({});
|
||||
|
|
Loading…
Reference in New Issue
Block a user