Skip to content

Commit 3671552

Browse files
committed
Renamed to SerializedExceptionHandler
1 parent b8f526c commit 3671552

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/labthings/httperrorhandler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from werkzeug.exceptions import HTTPException
44

55

6-
class JSONExceptionHandler:
6+
class SerializedExceptionHandler:
77

88
"""
99
A class to be registered as a Flask error handler,
10-
converts error codes into a JSON response
10+
converts error codes into a serialized response
1111
"""
1212

1313
def __init__(self, app=None):

src/labthings/labthing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212
from .extensions import BaseExtension
1313
from .utilities import clean_url_string
14-
from .httperrorhandler import JSONExceptionHandler
14+
from .httperrorhandler import SerializedExceptionHandler
1515
from .logging import LabThingLogger
1616
from .json.encoder import LabThingsJSONEncoder
1717
from .apispec import MarshmallowPlugin, rule_to_apispec_path
@@ -147,7 +147,7 @@ def init_app(self, app):
147147

148148
# Flask error formatter
149149
if self.format_flask_exceptions:
150-
error_handler = JSONExceptionHandler()
150+
error_handler = SerializedExceptionHandler()
151151
error_handler.init_app(app)
152152

153153
# Custom JSON encoder

tests/test_server_exceptions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from flask import Flask
2-
from labthings.labthing import JSONExceptionHandler
2+
from labthings.labthing import SerializedExceptionHandler
33
import json
44
import pytest
55

@@ -21,14 +21,14 @@ def app():
2121

2222

2323
def test_registering_handler(app):
24-
error_handler = JSONExceptionHandler()
24+
error_handler = SerializedExceptionHandler()
2525
error_handler.init_app(app)
2626

2727

2828
def test_http_exception(app):
2929
from werkzeug.exceptions import NotFound
3030

31-
error_handler = JSONExceptionHandler(app)
31+
error_handler = SerializedExceptionHandler(app)
3232

3333
# Test a 404 HTTPException
3434
response = error_handler.std_handler(NotFound())
@@ -43,7 +43,7 @@ def test_http_exception(app):
4343

4444

4545
def test_generic_exception(app):
46-
error_handler = JSONExceptionHandler(app)
46+
error_handler = SerializedExceptionHandler(app)
4747

4848
# Test a 404 HTTPException
4949
response = error_handler.std_handler(RuntimeError("Exception message"))
@@ -58,7 +58,7 @@ def test_generic_exception(app):
5858

5959

6060
def test_blank_exception(app):
61-
error_handler = JSONExceptionHandler(app)
61+
error_handler = SerializedExceptionHandler(app)
6262

6363
e = Exception()
6464
e.message = None

0 commit comments

Comments
 (0)