working on backend-side translations
This commit is contained in:
@@ -8,6 +8,8 @@ import static de.srsoftware.tools.jdbc.Query.SelectQuery.ALL;
|
||||
import static de.srsoftware.umbrella.bookmarks.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.Constants.ERROR_FAILED_CREATE_TABLE;
|
||||
import static de.srsoftware.umbrella.core.Errors.*;
|
||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.databaseException;
|
||||
import static java.lang.System.Logger.Level.ERROR;
|
||||
import static java.text.MessageFormat.format;
|
||||
import static java.time.ZoneOffset.UTC;
|
||||
@@ -52,8 +54,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
stmt.execute();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
LOG.log(ERROR, ERROR_FAILED_CREATE_TABLE, TABLE_URL_COMMENTS, e);
|
||||
throw new RuntimeException(e);
|
||||
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_URL_COMMENTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +65,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
stmt.execute();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
LOG.log(ERROR, ERROR_FAILED_CREATE_TABLE, TABLE_URLS, e);
|
||||
throw new RuntimeException(e);
|
||||
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_URLS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
rs.close();;
|
||||
return map;
|
||||
} catch (SQLException e) {
|
||||
throw new UmbrellaException("Failed to load bookmark list");
|
||||
throw databaseException(FAILED_TO_LOAD_BOOKMARKS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
rs.close();;
|
||||
return map;
|
||||
} catch (SQLException e) {
|
||||
throw new UmbrellaException("Failed to load bookmark list");
|
||||
throw databaseException(FAILED_TO_LOAD_BOOKMARKS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
if (result != null) return result;
|
||||
throw UmbrellaException.notFound("no_bookmark_for_urlid",id);
|
||||
} catch (SQLException e) {
|
||||
throw new UmbrellaException("Failed to load bookmark");
|
||||
throw databaseException(FAILED_TO_LOAD_BOOKMARK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
query.execute(db).close();
|
||||
return Bookmark.of(urlId,url,comment,timestamp);
|
||||
} catch (SQLException e) {
|
||||
throw new UmbrellaException("Failed to store url");
|
||||
throw databaseException(FAILED_TO_STORE_URL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user