From 3f4bd472cff03aa41055151bde3390f2c5e747cd Mon Sep 17 00:00:00 2001 From: Christian Paul Date: Sun, 1 May 2022 15:19:53 +0200 Subject: [PATCH] Ignore upstream issue: Unimplemented type: 4 --- src/Tile.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Tile.js b/src/Tile.js index cca3942..bd4fed9 100644 --- a/src/Tile.js +++ b/src/Tile.js @@ -20,12 +20,23 @@ export default class Tile { async load(buffer) { const unzippedBuffer = await this._unzipIfNeeded(buffer); - await this._loadTile(unzippedBuffer); - await this._loadLayers(); + this._loadTile(unzippedBuffer); + this._loadLayers(); } _loadTile(buffer) { - this.tile = new VectorTile(new Protobuf(buffer)); + try { + this.tile = new VectorTile(new Protobuf(buffer)); + } catch (error) { + // Ignoring upstream issue https://github.com/rastapasta/mapscii/issues/87 + if (error.message === 'Unimplemented type: 4') { + this.tile = { + layers: [], + }; + return; + } + throw error; + } } _unzipIfNeeded(buffer) {