Skip to content

Commit

Permalink
Merge pull request #10 from arXiv/error-handling
Browse files Browse the repository at this point in the history
Error handling
  • Loading branch information
kyokukou authored Jan 13, 2025
2 parents 93e2a55 + a34c747 commit 27826d9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
5 changes: 4 additions & 1 deletion oaipmh/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ class Settings(arxiv_base.Settings):
SQLALCHEMY_MAX_OVERFLOW: Optional[int] = 0
SQLALCHEMY_POOL_SIZE: Optional[int] = 10

FLASKS3_BUCKET_NAME: str = "some_bucket" #TODO needed to use url for for some reason?
FLASKS3_CDN_DOMAIN: str = "static.arxiv.org"
FLASKS3_USE_HTTPS: bool = True
FLASKS3_FORCE_MIMETYPE: bool = True
FLASKS3_ACTIVE: bool = False

def check(self) -> None:
"""A check and fix up of a settings object."""
Expand Down
6 changes: 0 additions & 6 deletions oaipmh/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ def handle_oai_error(e):
headers={"Content-Type":"application/xml"}
return response, 200, headers

#TODO make this actually trigger
@app.errorhandler(HTTPException)
def handle_http_error(e):
print("main error handler ran!")
return e.description, e.code, {}

app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
if not app.jinja_env.globals:
Expand Down
14 changes: 13 additions & 1 deletion tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,16 @@ def test_basic(test_client):
assert response.status_code == 200
assert 'xmlns="http://www.openarchives.org/OAI/2.0/"' in text
assert '<responseDate>' in text
assert '/oai</request>' in text
assert '/oai</request>' in text
assert 'badVerb' in text

def test_404(test_client):
response = test_client.get("/oai/rainbows")
text=response.text
assert response.status_code == 404
assert 'Not Found' in text

response = test_client.get("/oai/")
text=response.text
assert response.status_code == 404
assert 'Not Found' in text

0 comments on commit 27826d9

Please sign in to comment.