Skip to content

Commit

Permalink
added some missing logging in RestApi [see #127]
Browse files Browse the repository at this point in the history
  • Loading branch information
FreakyBytes committed Oct 8, 2015
1 parent 30cd404 commit 3edeede
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/de/unirostock/sems/cbarchive/web/rest/RestApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,10 @@ public Response deleteWorkspace( @CookieParam(Fields.COOKIE_PATH) String userPat
history.getRecentWorkspaces().add( user.getWorkspace() );
history.setCurrentWorkspace( user.getWorkspaceId() );

if( workspaceId == null || workspaceId.isEmpty() )
if( workspaceId == null || workspaceId.isEmpty() ) {
LOGGER.error("No workspace id was provided for deletion");
return buildErrorResponse(400, user, "No workspace ID provided");
}

// removes workspace
history.removeWorkspaceFromHistory(workspaceId);
Expand Down Expand Up @@ -433,8 +435,10 @@ public Response updateOwnVcard( @CookieParam(Fields.COOKIE_PATH) String userPath
user.setData(data);
return buildResponse(200, user).entity(user.getData()).build();
}
else
else {
LOGGER.warn("User ", user.getWorkspaceId(), " has provided insufficient information to update vCard");
return buildErrorResponse(400, user, "insufficient user information");
}
}

// --------------------------------------------------------------------------------
Expand Down Expand Up @@ -1077,8 +1081,10 @@ public Response deleteArchiveEntry( @PathParam("archive_id") String archiveId, @

if( result )
return buildResponse(200, user).entity("ok").build();
else
else {
LOGGER.error("Cannot move meta description for entry ", entryId, " in Archive ", archiveId, " in Workspace ", user.getWorkspaceId());
return buildErrorResponse(500, user, "Cannot remove meta description");
}
} catch (TransformerException e) {
LOGGER.error(e, MessageFormat.format("Cannot pack archive {0} entries in WorkingDir {1}", archiveId, user.getWorkingDir()) );
return buildErrorResponse( 500, user, "Cannot delete meta info", "Cannot pack archive " + archiveId + " entries in WorkingDir " + user.getWorkingDir().toString(), e.getMessage() );
Expand Down Expand Up @@ -1369,8 +1375,10 @@ public Response deleteMetaObject( @PathParam("archive_id") String archiveId, @Pa

if( result )
return buildResponse(200, user).entity("ok").build();
else
else {
LOGGER.error("Cannot remove meta description for entry ", entryId, " in Archive ", archiveId, " in Workspace ", user.getWorkspaceId());
return buildErrorResponse(500, user, "Cannot remove meta description");
}
} catch (TransformerException e) {
LOGGER.error(e, MessageFormat.format("Cannot pack archive {0} entries in WorkingDir {1}", archiveId, user.getWorkingDir()) );
return buildErrorResponse( 500, user, "Cannot delete meta info", "Cannot pack archive " + archiveId + " entries in WorkingDir " + user.getWorkingDir().toString(), e.getMessage() );
Expand Down

0 comments on commit 3edeede

Please sign in to comment.