Skip to content
Snippets Groups Projects
Unverified Commit 7d084235 authored by Martin Weise's avatar Martin Weise
Browse files

More detailed error responses both front- and backend

parent d878a5e4
No related branches found
No related tags found
4 merge requests!129New module for citation as they occur multiple,!121Modified logging, modified logging level, modified flasgger endpoint,!113Resolve "Bugs related with Query Service",!112Resolve "Bugs related with Query Service"
...@@ -450,7 +450,7 @@ public interface QueryMapper { ...@@ -450,7 +450,7 @@ public interface QueryMapper {
default PreparedStatement tableCsvDtoToRawDeleteQuery(Connection connection, Table table, TableCsvDeleteDto data) default PreparedStatement tableCsvDtoToRawDeleteQuery(Connection connection, Table table, TableCsvDeleteDto data)
throws TableMalformedException, ImageNotSupportedException, QueryMalformedException { throws TableMalformedException, ImageNotSupportedException, QueryMalformedException {
log.debug("table csv to delete query, table={}, data={}", table, data); log.trace("table csv to delete query, table={}, data={}", table, data);
int i = 1; int i = 1;
if (table.getColumns().size() == 0) { if (table.getColumns().size() == 0) {
log.error("Column size is zero"); log.error("Column size is zero");
...@@ -497,7 +497,7 @@ public interface QueryMapper { ...@@ -497,7 +497,7 @@ public interface QueryMapper {
default PreparedStatement tableCsvDtoToRawUpdateQuery(Connection connection, Table table, TableCsvUpdateDto data) default PreparedStatement tableCsvDtoToRawUpdateQuery(Connection connection, Table table, TableCsvUpdateDto data)
throws TableMalformedException, ImageNotSupportedException, QueryMalformedException { throws TableMalformedException, ImageNotSupportedException, QueryMalformedException {
log.debug("mapping table csv to update query, table={}, data={}", table, data); log.trace("mapping table csv to update query, table={}, data={}", table, data);
int i = 1; int i = 1;
if (table.getColumns().size() == 0) { if (table.getColumns().size() == 0) {
log.error("Column size is zero"); log.error("Column size is zero");
...@@ -570,7 +570,7 @@ public interface QueryMapper { ...@@ -570,7 +570,7 @@ public interface QueryMapper {
default PreparedStatement tableToRawCountAllQuery(Connection connection, Table table, Instant timestamp) default PreparedStatement tableToRawCountAllQuery(Connection connection, Table table, Instant timestamp)
throws ImageNotSupportedException, QueryMalformedException { throws ImageNotSupportedException, QueryMalformedException {
log.debug("mapping table to raw count query, table={}, timestamp={}", table, timestamp); log.trace("mapping table to raw count query, table={}, timestamp={}", table, timestamp);
/* check image */ /* check image */
if (!table.getDatabase().getContainer().getImage().getRepository().equals("mariadb")) { if (!table.getDatabase().getContainer().getImage().getRepository().equals("mariadb")) {
log.error("Currently only MariaDB is supported"); log.error("Currently only MariaDB is supported");
...@@ -599,7 +599,7 @@ public interface QueryMapper { ...@@ -599,7 +599,7 @@ public interface QueryMapper {
Instant timestamp, Boolean selection, Long page, Long size) Instant timestamp, Boolean selection, Long page, Long size)
throws ImageNotSupportedException, throws ImageNotSupportedException,
QueryMalformedException { QueryMalformedException {
log.debug("mapping query to timestamped query, query={}, database={}, timestamp={}, selection={}, page={}, size={}", log.trace("mapping query to timestamped query, query={}, database={}, timestamp={}, selection={}, page={}, size={}",
query, database, timestamp, selection, page, size); query, database, timestamp, selection, page, size);
/* param check */ /* param check */
if (!database.getContainer().getImage().getRepository().equals("mariadb")) { if (!database.getContainer().getImage().getRepository().equals("mariadb")) {
...@@ -669,9 +669,8 @@ public interface QueryMapper { ...@@ -669,9 +669,8 @@ public interface QueryMapper {
+ "' "); + "' ");
} }
try { try {
final PreparedStatement pstmt = connection.prepareStatement(statement.toString()); log.debug("mapped timestamped query: {}", statement);
log.trace("mapped timestamped query {} to prepared statement {}", statement, pstmt); return connection.prepareStatement(statement.toString());
return pstmt;
} catch (SQLException e) { } catch (SQLException e) {
log.error("Failed to prepare statement {}, reason: {}", statement, e.getMessage()); log.error("Failed to prepare statement {}, reason: {}", statement, e.getMessage());
throw new QueryMalformedException("Failed to prepare statement", e); throw new QueryMalformedException("Failed to prepare statement", e);
...@@ -680,7 +679,7 @@ public interface QueryMapper { ...@@ -680,7 +679,7 @@ public interface QueryMapper {
default PreparedStatement tableToRawFindAllQuery(Connection connection, Table table, Instant timestamp, Long size, Long page) default PreparedStatement tableToRawFindAllQuery(Connection connection, Table table, Instant timestamp, Long size, Long page)
throws ImageNotSupportedException, QueryMalformedException { throws ImageNotSupportedException, QueryMalformedException {
log.debug("mapping table to find all query, table={}, timestamp={}, size={}, page={}", log.trace("mapping table to find all query, table={}, timestamp={}, size={}, page={}",
table, timestamp, size, page); table, timestamp, size, page);
/* param check */ /* param check */
if (!table.getDatabase().getContainer().getImage().getRepository().equals("mariadb")) { if (!table.getDatabase().getContainer().getImage().getRepository().equals("mariadb")) {
......
...@@ -99,7 +99,7 @@ public class QueryServiceImpl extends HibernateConnector implements QueryService ...@@ -99,7 +99,7 @@ public class QueryServiceImpl extends HibernateConnector implements QueryService
columns = parseColumns(query.getQuery(), database); columns = parseColumns(query.getQuery(), database);
} catch (JSQLParserException e) { } catch (JSQLParserException e) {
log.error("Failed to map/parse columns: {}", e.getMessage()); log.error("Failed to map/parse columns: {}", e.getMessage());
throw new ColumnParseException("Failed to map/parse columns", e); throw new ColumnParseException(e.getMessage(), e);
} }
final QueryResultDto dto; final QueryResultDto dto;
try { try {
...@@ -422,7 +422,7 @@ public class QueryServiceImpl extends HibernateConnector implements QueryService ...@@ -422,7 +422,7 @@ public class QueryServiceImpl extends HibernateConnector implements QueryService
final String tableName = queryMapper.stringToEscapedString(fromItem.toString()); final String tableName = queryMapper.stringToEscapedString(fromItem.toString());
log.error("Table with name {} does not exist, available names: {}", tableName, log.error("Table with name {} does not exist, available names: {}", tableName,
database.getTables().stream().map(Table::getInternalName).collect(Collectors.toList())); database.getTables().stream().map(Table::getInternalName).collect(Collectors.toList()));
throw new JSQLParserException("Table does not exist"); throw new JSQLParserException("Table " + tableName + " does not exist");
} }
} }
...@@ -445,7 +445,7 @@ public class QueryServiceImpl extends HibernateConnector implements QueryService ...@@ -445,7 +445,7 @@ public class QueryServiceImpl extends HibernateConnector implements QueryService
if (i) { if (i) {
log.error("Column {} does not exist, available columns are {}", item, log.error("Column {} does not exist, available columns are {}", item,
allColumns.stream().map(TableColumn::getInternalName).collect(Collectors.toList())); allColumns.stream().map(TableColumn::getInternalName).collect(Collectors.toList()));
throw new JSQLParserException("Column does not exist"); throw new JSQLParserException("Column " + item + " does not exist");
} }
} }
return columns; return columns;
......
...@@ -145,7 +145,7 @@ public class StoreServiceImpl extends HibernateConnector implements StoreService ...@@ -145,7 +145,7 @@ public class StoreServiceImpl extends HibernateConnector implements StoreService
final PreparedStatement preparedStatement = storeMapper.queryStoreRawInsertQuery(connection, query); final PreparedStatement preparedStatement = storeMapper.queryStoreRawInsertQuery(connection, query);
final ResultSet resultSet = preparedStatement.executeQuery(); final ResultSet resultSet = preparedStatement.executeQuery();
query.setId(storeMapper.resultSetToId(resultSet)); query.setId(storeMapper.resultSetToId(resultSet));
log.error("Inserted query {} into the query store of database with id {}", query.getQuery(), databaseId); log.info("Inserted query {} into the query store of database with id {}", query.getQuery(), databaseId);
log.trace("inserted query {} into the query store of database {}", query, database); log.trace("inserted query {} into the query store of database {}", query, database);
return query; return query;
} catch (SQLException e) { } catch (SQLException e) {
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
disable-sort disable-sort
:loading="loadingDetails" :loading="loadingDetails"
hide-default-footer hide-default-footer
items-per-page="-1" :items-per-page="-1"
:headers="headers" :headers="headers"
:items="tableDetails.columns"> :items="tableDetails.columns">
<template v-slot:item.is_null_allowed="{ item }"> <template v-slot:item.is_null_allowed="{ item }">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment