Skip to content
Snippets Groups Projects
Commit 871a3057 authored by Daniel Lyons's avatar Daniel Lyons Committed by Charlotte Hausman
Browse files

Product fetcher: better errors

parent e15be403
No related branches found
No related tags found
1 merge request!436Product fetcher: better errors
Pipeline #2600 passed
......@@ -6,6 +6,7 @@ The distinction matters to the RetryingFileFetcher, which will re-attempt a fetc
if it is interrupted by a RetryableFetchError.
"""
import traceback
from pathlib import Path
......@@ -19,6 +20,7 @@ class FetchError(Exception):
def terminate_fetch(self):
print(self.message)
traceback.print_exception(type(self), self, self.__traceback__)
class RetryableFetchError(FetchError):
......@@ -32,7 +34,7 @@ class RetryableFetchError(FetchError):
def terminate_fetch(self):
print(f"A retryable problem occurred, but was not resolved after {self.retries} retries.")
print("You may succeed by running the program again.")
print(self.message)
super().terminate_fetch()
class FileValidationFault(FetchError):
......@@ -74,9 +76,7 @@ class NgasServiceErrorException(FetchError):
self.reason = reason
def terminate_fetch(self):
print(
f"NGAS error: {self.message} ({self.url} returned {self.status_code} with reason {self.reason})"
)
print(f"NGAS error: {self.message} ({self.url} returned {self.status_code} with reason {self.reason})")
class LocatorServiceException(FetchError):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment