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

Catching Error too in isOpenApiStr #490

Merged
merged 2 commits into from
Nov 6, 2023
Merged

Conversation

Jolanrensen
Copy link
Collaborator

Fixes #489

@Jolanrensen Jolanrensen added the bug Something isn't working label Nov 6, 2023
@Jolanrensen Jolanrensen requested a review from zaleslaw November 6, 2023 14:01
@@ -8,7 +8,7 @@ import java.net.URL
public fun isOpenApiStr(text: String): Boolean = try {
val parsed = OpenAPIParser().readContents(text, null, null)
parsed.openAPI?.components?.schemas != null
} catch (_: Exception) {
} catch (_: Throwable) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm thinking, could we give more info here, just logging the reason of Error or Exception, now it silently happened

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or, if logger is not setup, create a TODO with "add logger"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm, we already have the problem of the openAPI parser logging exceptions each time we read anything with DataFrame. I don't want to needlessly log even more stuff in this case. That said, adding a logger at level INFO or DEBUG might still be beneficial indeed.

Copy link
Collaborator

@zaleslaw zaleslaw Nov 6, 2023

Choose a reason for hiding this comment

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

So sad about openAPI parser logging during reading, Debug level will be a good option, so, probably a good idea to add to-do or comment, to this issue or to the openAPI parser logging exception issue (if it exists), to explain why we doing it silently, because for me, it looks like antipattern

Copy link
Collaborator

@zaleslaw zaleslaw left a comment

Choose a reason for hiding this comment

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

Silent Throwable

@zaleslaw zaleslaw self-requested a review November 6, 2023 16:06
@Jolanrensen Jolanrensen requested a review from zaleslaw November 6, 2023 16:21
@Jolanrensen Jolanrensen merged commit 6489a54 into master Nov 6, 2023
@Jolanrensen
Copy link
Collaborator Author

Also cherry picked into https://github.com/Kotlin/dataframe/tree/0.12.1

@Jolanrensen Jolanrensen deleted the isOpenApi-error-fix branch November 6, 2023 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catch Error as wel as Exception when parsing OpenAPI
2 participants