Skip to content

Commit

Permalink
Document and handle the actual exceptions returned by register.
Browse files Browse the repository at this point in the history
  • Loading branch information
mwoodiupui committed Jan 21, 2025
1 parent 7742516 commit 2edea69
Showing 1 changed file with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ public static void runCLI(Context context, DOIOrganiser organiser, String[] args
}
}
} catch (SQLException ex) {
System.err.println("Error in database connection:" + ex.getMessage());
System.err.format("Error in database connection: %s%n", ex.getMessage());
ex.printStackTrace(System.err);
} catch (DOIIdentifierException ex) {
System.err.println("Error registering DOI identifier:" + ex.getMessage());
} catch (RuntimeException ex) {
System.err.format("Error registering DOI identifier: %s%n", ex.getMessage());
}
}

Expand Down Expand Up @@ -422,12 +422,18 @@ public void list(String processName, PrintStream out, PrintStream err, Integer .

/**
* Register DOI with the provider
* @param doiRow - doi to register
* @param filter - logical item filter to override
* @throws SQLException
* @throws DOIIdentifierException
* @param doiRow DOI to register
* @param filter logical item filter to override
* @throws IllegalArgumentException
* if {@link doiRow} does not name an Item.
* @throws IllegalStateException
* on invalid DOI.
* @throws RuntimeException
* on database error.
*/
public void register(DOI doiRow, Filter filter) throws SQLException, DOIIdentifierException {
public void register(DOI doiRow, Filter filter)
throws IllegalArgumentException, IllegalStateException,
RuntimeException {
DSpaceObject dso = doiRow.getDSpaceObject();
if (Constants.ITEM != dso.getType()) {
throw new IllegalArgumentException("Currenty DSpace supports DOIs for Items only.");
Expand Down Expand Up @@ -495,11 +501,14 @@ public void register(DOI doiRow, Filter filter) throws SQLException, DOIIdentifi

/**
* Register DOI with the provider.
* @param doiRow - doi to register
* @throws SQLException passed through
* @throws DOIIdentifierException passed through
* @param doiRow DOI to register
* @throws IllegalArgumentException passed through.
* @throws IllegalStateException passed through.
* @throws RuntimeException passed through.
*/
public void register(DOI doiRow) throws SQLException, DOIIdentifierException {
public void register(DOI doiRow)
throws IllegalStateException, IllegalArgumentException,
RuntimeException {
register(doiRow, this.filter);
}

Expand Down

0 comments on commit 2edea69

Please sign in to comment.