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

CODE: pass over looking at exception handling and reporting [KQL-395] #395

Merged
merged 6 commits into from
Oct 19, 2017
Merged

CODE: pass over looking at exception handling and reporting [KQL-395] #395

merged 6 commits into from
Oct 19, 2017

Conversation

bluemonk3y
Copy link

#394 - pass over to review exception and log handling.

@bluemonk3y bluemonk3y changed the title pass over looking at exception handling and reporting CODE: pass over looking at exception handling and reporting [KQL-395] Oct 18, 2017
@@ -155,7 +154,7 @@ public static boolean createFile(Path path) {
}
return true;
} catch (Exception e) {
LOGGER.error(ExceptionUtil.stackTraceToString(e));
LOGGER.error("createFile failed, path:" + path, e);
Copy link
Contributor

Choose a reason for hiding this comment

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

is this an error or should it be warn?

Copy link
Contributor

Choose a reason for hiding this comment

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

also here and everywhere else in the log statements we should use "{}" for args rather than string concatentation

Copy link
Author

Choose a reason for hiding this comment

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

done

@@ -159,11 +159,9 @@ private Schema getKsqlType(final String sqlType) {

private Schema getKsqlComplexType(final String sqlType) {
if (sqlType.startsWith("ARRAY")) {
return SchemaBuilder
.array(getKsqlType(sqlType.substring("ARRAY".length() + 1, sqlType.length() - 1)));
return SchemaBuilder.array(getKsqlType(sqlType.substring("ARRAY".length() + 1, sqlType.length() - 1)));
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps we should turn "ARRAY" and "MAP" into constants?

Copy link
Author

Choose a reason for hiding this comment

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

done

} else if (sqlType.startsWith("MAP")) {
//TODO: For now only primitive data types for map are supported. Will have to add
// nested types.
//TODO: For now only primitive data types for map are supported. Will have to add nested types.
Copy link
Contributor

Choose a reason for hiding this comment

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

Raise a github issue?

@@ -61,7 +61,7 @@ private static DDLCommandResult executeOnMetaStore(DDLCommand ddlCommand, MetaSt
return ddlCommand.run(metaStore);
} catch (Exception e) {
String stackTrace = ExceptionUtil.stackTraceToString(e);
LOGGER.error(stackTrace);
LOGGER.error("executeOnMetaStore:" + ddlCommand + " failed", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be warn? I see error as something that is going to blow everything up, but this continues.

Copy link
Author

Choose a reason for hiding this comment

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

warn and string.format

@@ -301,7 +297,7 @@ private SourceDescription describe(String statementText, String name) throws Exc

StructuredDataSource dataSource = ksqlEngine.getMetaStore().getSource(name);
if (dataSource == null) {
throw new Exception(String.format("Could not find data stream/table '%s' in the metastore",
throw new Exception(String.format("Could not find STREAM/TABLE '%s' in the Metastore",
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this was here already, but throwing Exception - really? above too

Copy link
Author

Choose a reason for hiding this comment

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

i think it propagates to the client where it gets logged

@bluemonk3y
Copy link
Author

retest this please

@bluemonk3y
Copy link
Author

retest this please

2 similar comments
@bluemonk3y
Copy link
Author

retest this please

@bluemonk3y
Copy link
Author

retest this please

@bluemonk3y
Copy link
Author

@dguy - take a look see pls

@dguy
Copy link
Contributor

dguy commented Oct 19, 2017

retest this please

Copy link
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

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

Thanks @bluemonk3y, you don't need the %s in the logging statements, just {}

@@ -523,7 +523,7 @@ private void printAsJson(Object o) throws IOException {
}
o = newEntities;
} else {
LOGGER.warn(String.format("Unexpected result class: '%s' found in printAsJson", o.getClass().getCanonicalName()));
log.warn("Unexpected result class: '{%s}' found in printAsJson", o.getClass().getCanonicalName());
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need the %s

@@ -155,7 +154,7 @@ public static boolean createFile(Path path) {
}
return true;
} catch (Exception e) {
LOGGER.error(ExceptionUtil.stackTraceToString(e));
log.warn("createFile failed, path: {%s}", path, e);
Copy link
Contributor

Choose a reason for hiding this comment

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

same here and everywhere else i guess

Copy link
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

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

LGTM

@bluemonk3y bluemonk3y merged commit 67c3cff into confluentinc:4.0.x Oct 19, 2017
@bluemonk3y bluemonk3y deleted the 4.0.x-CODE-exception-error-reporting branch October 19, 2017 15:16
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