From 5b0c3b40a4c6c3d7669344e10e4e3c9cad57e433 Mon Sep 17 00:00:00 2001 From: Patrick Kunzmann Date: Mon, 24 Oct 2022 13:27:43 +0200 Subject: [PATCH] Update database error messages --- src/biotite/database/entrez/check.py | 8 ++++++-- src/biotite/database/rcsb/download.py | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/biotite/database/entrez/check.py b/src/biotite/database/entrez/check.py index 9b5b9dd5a..3e8b38cf8 100644 --- a/src/biotite/database/entrez/check.py +++ b/src/biotite/database/entrez/check.py @@ -19,6 +19,7 @@ "Service unavailable", "Server Error", "ID list is empty", + "Supplied id parameter is empty", "Resource temporarily unavailable", "Failed to retrieve sequence", "Failed to understand id", @@ -40,7 +41,10 @@ def check_for_errors(message): If the message contains an error message. """ # Error always appear at the end of message - message_end = message[-100:] + message_end = message[-200:] + # Seemingly arbitrary '+' characters are in NCBI error messages + message_end = message_end.replace("+", "") for error_msg in _error_messages: - if error_msg in message_end: + # Often whitespace is also replaced by '+' in error message + if error_msg.replace(" ", "") in message_end: raise RequestError(error_msg) \ No newline at end of file diff --git a/src/biotite/database/rcsb/download.py b/src/biotite/database/rcsb/download.py index 2d2804a25..36a287a88 100644 --- a/src/biotite/database/rcsb/download.py +++ b/src/biotite/database/rcsb/download.py @@ -157,6 +157,7 @@ def _assert_valid_file(response_text, pdb_id): if any(err_msg in response_text for err_msg in [ "404 Not Found", "RCSB Protein Data Bank Error Page", - "No fasta files were found." + "No fasta files were found.", + "No valid PDB IDs were submitted.", ]): raise RequestError("PDB ID {:} is invalid".format(pdb_id))