Skip to content

Commit 54e2cf7

Browse files
committed
Improve MissingSettingError's style
1 parent 1e62e7a commit 54e2cf7

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "scrapy-influxdb-exporter"
7-
version = "1.1.1"
7+
version = "1.1.2"
88
authors = [{ "name" = "Stefano Fusai", "email" = "[email protected]" }]
99
description = "A simple package to export Scrapy spider stats to InfluxDB"
1010
readme = "README.md"
+2-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
class SettingMissingError(Exception):
1+
class MissingSettingError(Exception):
22
"""Raised when a required setting is missing."""
33

4-
def __init__(self, setting: str) -> None:
5-
"""Construct an instance of the SettingMissingError class.
6-
7-
:param setting: The name of the missing setting.
8-
:type setting: str
9-
"""
4+
def __init__(self, setting: str) -> None: # noqa: D107
105
super().__init__(f"{setting} setting is missing")

src/scrapy_influxdb_exporter/statscollectors.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from scrapy.crawler import Crawler
66
from scrapy.statscollectors import StatsCollector, StatsT
77

8-
from .exceptions import SettingMissingError
8+
from .exceptions import MissingSettingError
99

1010

1111
class InfluxDBStatsCollector(StatsCollector):
@@ -37,14 +37,14 @@ def _get_setting(self, name: str) -> str:
3737
3838
:param name: The name of the setting.
3939
:type name: str
40-
:raises SettingMissingError: If the setting is missing.
40+
:raises MissingSettingError: If the setting is missing.
4141
:return: The value of the setting.
4242
:rtype: str
4343
"""
4444
setting = self.crawler.settings.get(name)
4545

4646
if setting is None:
47-
raise SettingMissingError(name)
47+
raise MissingSettingError(name)
4848

4949
return setting
5050

0 commit comments

Comments
 (0)