Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Add mapping API exception type
Browse files Browse the repository at this point in the history
jillurquddus committed Aug 17, 2022
1 parent bc02be3 commit 30de316
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@

@RestController
@RequestMapping("/mapping")
@Tag(name = "Mapping API", description = "API for undertaking common mapping operations")
@Tag(name = "Mapping API", description = "API for undertaking common ontology mapping operations")
public class OntologyMappingController {

private static final Logger LOGGER =
@@ -178,9 +178,9 @@ public ResponseEntity<String> map(
}

// If neither a WebProtege project ID or ontology file is provided
else return new ResponseEntity<>("Neither a WebProtege project ID nor "
+ "an ontology data file were provided.",
HttpStatus.BAD_REQUEST);
else throw new OntologyMapperInvalidRequestException(
OntologyMapperInvalidRequestException
.ErrorKey.MISSING_REQUEST_PARAMETER_SOURCE_DATA);

}

Original file line number Diff line number Diff line change
@@ -24,7 +24,8 @@ public enum ErrorKey {
INVALID_ONTOLOGY_DATA_FILE_SEMANTICS("InvalidOntologyDataFileSemantics"),
INVALID_ONTOLOGY_DATA_FILE_SIZE("InvalidOntologyDataFileSize"),
INVALID_SOURCE_FORMAT("InvalidSourceFormat"),
INVALID_TARGET_FORMAT("InvalidTargetFormat");
INVALID_TARGET_FORMAT("InvalidTargetFormat"),
MISSING_REQUEST_PARAMETER_SOURCE_DATA("MissingRequestParameterSourceData");

private final String key;

Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ OntologyMapperInvalidRequestExceptionInvalidOntologyDataFileSemantics=Invalid on
OntologyMapperInvalidRequestExceptionInvalidOntologyDataFileSize=Invalid ontology file - the supplied ontology file exceeds the maximum file size allowed (1MB).
OntologyMapperInvalidRequestExceptionInvalidSourceFormat=Invalid ontology mapping request - the requested source format is invalid.
OntologyMapperInvalidRequestExceptionInvalidTargetFormat=Invalid ontology mapping request - the requested target format is invalid.
OntologyMapperInvalidRequestExceptionMissingRequestParameterSourceData=Invalid ontology mapping request - please provide either an ontology file or a WebProtégé project ID.

# OntologyNotFoundException
OntologyNotFoundExceptionDefault=The requested ontology was not found.
Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ OntologyMapperInvalidRequestExceptionInvalidOntologyDataFileSemantics=Invalid on
OntologyMapperInvalidRequestExceptionInvalidOntologyDataFileSize=Invalid ontology file - the supplied ontology file exceeds the maximum file size allowed (1MB).
OntologyMapperInvalidRequestExceptionInvalidSourceFormat=Invalid ontology mapping request - the requested source format is invalid.
OntologyMapperInvalidRequestExceptionInvalidTargetFormat=Invalid ontology mapping request - the requested target format is invalid.
OntologyMapperInvalidRequestExceptionMissingRequestParameterSourceData=Invalid ontology mapping request - please provide either an ontology file or a WebProtégé project ID.

# OntologyNotFoundException
OntologyNotFoundExceptionDefault=The requested ontology was not found.

0 comments on commit 30de316

Please sign in to comment.