Added support for the CRUD operations on the MetadataField and MetadataSchema REST endpoints - feedback

This commit is contained in:
Samuel
2019-01-10 11:42:31 +01:00
committed by Raf Ponsaerts
parent 0a7a8aab8e
commit 34127e4e0f
3 changed files with 10 additions and 5 deletions

View File

@@ -22,7 +22,10 @@ import org.springframework.web.bind.annotation.ResponseStatus;
public class PatchBadRequestException extends RuntimeException {
public PatchBadRequestException(String message) {
super(message);
this(message, null);
}
public PatchBadRequestException(String message, Exception e) {
super(message, e);
}
}

View File

@@ -127,7 +127,7 @@ public class MetadataFieldRestRepository extends DSpaceRestRepository<MetadataFi
MetadataFieldRest.class
);
} catch (IOException excIO) {
throw new PatchBadRequestException("error parsing the body ..." + excIO.getMessage());
throw new PatchBadRequestException("error parsing request body", excIO);
}
// validate fields
@@ -179,7 +179,7 @@ public class MetadataFieldRestRepository extends DSpaceRestRepository<MetadataFi
metadataFieldService.delete(context, metadataField);
} catch (SQLException e) {
throw new RuntimeException(e.getMessage(), e);
throw new RuntimeException("error while trying to delete " + MetadataFieldRest.NAME + " with id: " + id, e);
}
}

View File

@@ -101,7 +101,7 @@ public class MetadataSchemaRestRepository extends DSpaceRestRepository<MetadataS
MetadataSchemaRest.class
);
} catch (IOException excIO) {
throw new PatchBadRequestException("error parsing the body ..." + excIO.getMessage());
throw new PatchBadRequestException("error parsing request body", excIO);
}
// validate fields
@@ -141,7 +141,9 @@ public class MetadataSchemaRestRepository extends DSpaceRestRepository<MetadataS
metadataSchemaService.delete(context, metadataSchema);
} catch (SQLException e) {
throw new RuntimeException(e.getMessage(), e);
throw new RuntimeException(
"error while trying to delete " + MetadataSchemaRest.NAME + " with id: " + id, e
);
}
}