working on backend-side translations
This commit is contained in:
@@ -9,6 +9,7 @@ import static de.srsoftware.umbrella.bookmarks.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.Constants.*;
|
||||
import static de.srsoftware.umbrella.core.Errors.*;
|
||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.databaseException;
|
||||
import static de.srsoftware.umbrella.core.exceptions.UmbrellaException.notFound;
|
||||
import static java.text.MessageFormat.format;
|
||||
import static java.time.ZoneOffset.UTC;
|
||||
|
||||
@@ -52,7 +53,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
stmt.execute();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_URL_COMMENTS);
|
||||
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_URL_COMMENTS).causedBy(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
stmt.execute();
|
||||
stmt.close();
|
||||
} catch (SQLException e) {
|
||||
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_URLS);
|
||||
throw databaseException(FAILED_TO_CREATE_TABLE,TABLE_URLS).causedBy(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
rs.close();;
|
||||
return map;
|
||||
} catch (SQLException e) {
|
||||
throw databaseException(FAILED_TO_LOAD_ENTITY,"bookmark list");
|
||||
throw databaseException(FAILED_TO_LOAD_ENTITY,"bookmark list").causedBy(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +96,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_DROP_ENTITY,"bookmark list").causedBy(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
rs.close();;
|
||||
return map;
|
||||
} catch (SQLException e) {
|
||||
throw databaseException(FAILED_TO_LOAD_ENTITY,"bookmark list");
|
||||
throw databaseException(FAILED_TO_LOAD_ENTITY,"bookmark list").causedBy(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,9 +124,9 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
if (rs.next()) result = Bookmark.of(rs);
|
||||
rs.close();
|
||||
if (result != null) return result;
|
||||
throw UmbrellaException.notFound("no_bookmark_for_urlid",id);
|
||||
throw notFound(NO_BOOKMARK_FOR_URLID,id);
|
||||
} catch (SQLException e) {
|
||||
throw databaseException(FAILED_TO_LOAD_ENTITY,"bookmark");
|
||||
throw databaseException(FAILED_TO_LOAD_ENTITY,"bookmark").causedBy(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +149,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
query.execute(db).close();
|
||||
return Bookmark.of(urlId,url,comment,timestamp);
|
||||
} catch (SQLException e) {
|
||||
throw databaseException(FAILED_TO_STORE_ENTITY,"url");
|
||||
throw databaseException(FAILED_TO_STORE_ENTITY,"url").causedBy(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user