From 68a09934a1f38c0d0ea3fabc64a5390894d931fa Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 27 May 2025 19:39:39 -0300 Subject: eslint: make use of optional catch binding more often --- src/data/cacheable-object.js | 4 ++-- src/data/checks.js | 2 +- src/data/thing.js | 4 ++-- src/data/things/artist.js | 2 +- src/data/things/contribution.js | 2 +- src/data/yaml.js | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/data') diff --git a/src/data/cacheable-object.js b/src/data/cacheable-object.js index a089e325..651a61cf 100644 --- a/src/data/cacheable-object.js +++ b/src/data/cacheable-object.js @@ -243,13 +243,13 @@ export class CacheableObjectPropertyValueError extends Error { try { inspectOldValue = inspect(oldValue); - } catch (error) { + } catch { inspectOldValue = colors.red(`(couldn't inspect)`); } try { inspectNewValue = inspect(newValue); - } catch (error) { + } catch { inspectNewValue = colors.red(`(couldn't inspect)`); } diff --git a/src/data/checks.js b/src/data/checks.js index 54bf85fd..a2a2e08f 100644 --- a/src/data/checks.js +++ b/src/data/checks.js @@ -686,7 +686,7 @@ export function reportContentTextErrors(wikiData, { } else if (node.type === 'external-link') { try { new URL(node.data.href); - } catch (error) { + } catch { yield { index, length, message: diff --git a/src/data/thing.js b/src/data/thing.js index 66f73de5..f719224d 100644 --- a/src/data/thing.js +++ b/src/data/thing.js @@ -60,7 +60,7 @@ export default class Thing extends CacheableObject { if (this.name) { name = colors.green(`"${this.name}"`); } - } catch (error) { + } catch { name = colors.yellow(`couldn't get name`); } @@ -69,7 +69,7 @@ export default class Thing extends CacheableObject { if (this.directory) { reference = colors.blue(Thing.getReference(this)); } - } catch (error) { + } catch { reference = colors.yellow(`couldn't get reference`); } diff --git a/src/data/things/artist.js b/src/data/things/artist.js index f516098b..5b67051c 100644 --- a/src/data/things/artist.js +++ b/src/data/things/artist.js @@ -286,7 +286,7 @@ export class Artist extends Thing { let aliasedArtist; try { aliasedArtist = this.aliasedArtist.name; - } catch (_error) { + } catch { aliasedArtist = CacheableObject.getUpdateValue(this, 'aliasedArtist'); } diff --git a/src/data/things/contribution.js b/src/data/things/contribution.js index c92fafb4..b3655eb8 100644 --- a/src/data/things/contribution.js +++ b/src/data/things/contribution.js @@ -259,7 +259,7 @@ export class Contribution extends Thing { let artist; try { artist = this.artist; - } catch (_error) { + } catch { // Computing artist might crash for any reason - don't distract from // other errors as a result of inspecting this contribution. } diff --git a/src/data/yaml.js b/src/data/yaml.js index e8d24353..9a0295b8 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -1022,7 +1022,7 @@ export const documentModes = { export function getAllDataSteps() { try { thingConstructors; - } catch (error) { + } catch { throw new Error(`Thing constructors aren't ready yet, can't get all data steps`); } -- cgit 1.3.0-6-gf8a5