Skip to content

Commit 161c56d

Browse files
committed
Tweak error case
1 parent 1941740 commit 161c56d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/job.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Path } from './path';
22
import { State } from './state';
33
import { Layer } from './layer';
4-
import { TravelTypeIndexer, LayersIndexer, ToolIndexer, Indexer, NonApplicableIndexer } from './indexers';
4+
import { TravelTypeIndexer, LayersIndexer, ToolIndexer, Indexer, NonApplicableIndexer, NonPlanarPathError } from './indexers';
55
import { BoundingBox } from './bounding-box';
66

77
/**
@@ -159,9 +159,12 @@ export class Job {
159159
throw e; // If the error is not a NonApplicableIndexer, it will be thrown.
160160
}
161161

162-
console.warn('Non-planar path detected; clearing layer index');
163-
this._layers = [];
162+
if (e instanceof NonPlanarPathError) {
163+
console.warn('Non-planar path detected; clearing layer index');
164+
this._layers = [];
165+
}
164166

167+
// Remove the indexer that cannot handle this path
165168
const i = this.indexers.indexOf(indexer);
166169
this.indexers.splice(i, 1);
167170
}

0 commit comments

Comments
 (0)