Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More expressive primary service init failure #476

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

t-ober
Copy link
Contributor

@t-ober t-ober commented Mar 1, 2023

Resolves #475

@t-ober t-ober changed the title more expressive primary service init failure More expressive primary service init failure Mar 1, 2023
t-ober and others added 2 commits March 1, 2023 15:52
# Conflicts:
#	CHANGELOG.md
#	src/main/scala/edu/ie3/simona/service/primary/PrimaryServiceWorker.scala
Copy link
Member

@sebastian-peter sebastian-peter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the initiative. Some short questions from my side here. Also, the test for PSW needs to be adapted once this is done, of course.

@@ -28,6 +28,7 @@ simona.input.primary.csvParams = {
directoryPath: "input/samples/vn_simona/fullGrid"
csvSep: ","
isHierarchic: false
timePattern: "yyyy-MM-dd'T'HH:mm:ss[.S[S][S]]'Z'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the default time pattern, so this line effectively does not change any configuraiton. Does it make sense to include it?

Comment on lines +94 to +98
case Failure(exc: DateTimeParseException) =>
throw new IOException(
s"Could not initiate the time series source. Parsing ${exc.getParsedString} failed with timepattern: $timePattern. The time pattern can be configured in the configuration.",
exc
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want this kind of distinction, would'nt it rather make sense to have it in PSDM?
So, everything that can go wrong within *TimeSeriesSource is fully described by an exception that its constructor throws. Then, when we arrive at the level of PrimaryServiceWorker, we can then wrap the exception once more and say: "During creation of the timeseries source, an error occured." or something like that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly solved here (or with an earlier PR). We should still check if DateTimeParseException is also wrapped in a SourceException within PSDM

valueClass,
factory
)
) match {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error matching would also be nice for SqlTimeSeriesSource as well, no? So maybe we can move this an abstraction level upwards, i.e. checking for Failure after *TimeSeriesSource has been created.

@sebastian-peter sebastian-peter added the enhancement New feature or request label Nov 21, 2023
@sebastian-peter sebastian-peter added this to the Version 4.0 milestone Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catch date time parsing exception to make error more expressive
2 participants