Skip to content

Stop swallowing exceptions in the $everything operation#2950

Merged
lmsurpre merged 1 commit into
mainfrom
lee-main
Nov 8, 2021
Merged

Stop swallowing exceptions in the $everything operation#2950
lmsurpre merged 1 commit into
mainfrom
lee-main

Conversation

@lmsurpre
Copy link
Copy Markdown
Member

@lmsurpre lmsurpre commented Nov 6, 2021

Signed-off-by: Lee Surprenant lmsurpre@us.ibm.com

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
@lmsurpre lmsurpre requested a review from prb112 November 6, 2021 02:30
} catch (Exception e) {
FHIROperationException exceptionWithIssue = buildExceptionWithIssue("An unexpected error occurred while creating the operation output parameters for the resulting Bundle.", IssueType.EXCEPTION);
FHIROperationException exceptionWithIssue = buildExceptionWithIssue("An unexpected error occurred while "
+ "creating the operation output parameters for the resulting Bundle.", IssueType.EXCEPTION, e);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I believe the PR review we asked that Luis not send back the exceptions. This is a bit of a design change.
I think this deserves a bit of javadoc explaining the choice so we don't go revisit this in the future and flip the other way.

Copy link
Copy Markdown
Member Author

@lmsurpre lmsurpre Nov 8, 2021

Choose a reason for hiding this comment

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

We need to either log the exceptions or add them to the wrapped exception, otherwise they are swallowed and its nearly impossible to know what went wrong.

Are you thinking javadoc at each location where we catch + wrap? Or just mention it once at the class level?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was just thinking at the class level.

Copy link
Copy Markdown
Member Author

@lmsurpre lmsurpre Nov 8, 2021

Choose a reason for hiding this comment

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

OK, how about I add something to our style guide at https://github.com/IBM/FHIR/wiki/Style-Guide about it instead?
maybe an ammendment to 24. Only catch an exception if you can do something about it...or need to
I could add a blurb about "rethrow, wrap, log and throw new, or handle; don't swallow unless you handle it"?

Copy link
Copy Markdown
Contributor

@prb112 prb112 left a comment

Choose a reason for hiding this comment

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

LGTM, (adding the Javadoc is just a nice to have)

@lmsurpre lmsurpre merged commit 9bbc4a7 into main Nov 8, 2021
@lmsurpre lmsurpre deleted the lee-main branch November 8, 2021 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants