UX-281: Renamed UnexpectedErrorExpcetion to UnexpectedErrorException

This commit is contained in:
Ivan Meredith 2016-04-27 13:40:17 +12:00
parent 40281621a2
commit 5c3dddbea8
7 changed files with 13 additions and 14 deletions

View File

@ -38,11 +38,11 @@ public class JsonConverter{
} catch (JsonMappingException e){
String msg = String.format("Failed to map Json to java type : %s. %s ", type, e.getMessage());
LOGGER.error(msg, e);
throw new ServiceException.UnexpectedErrorExpcetion(msg);
throw new ServiceException.UnexpectedErrorException(msg);
} catch (IOException e) {
String msg = String.format("Failed to convert %s to type %s", data, type);
LOGGER.error(msg, e);
throw new ServiceException.UnexpectedErrorExpcetion(msg);
throw new ServiceException.UnexpectedErrorException(msg);
}
}

View File

@ -243,20 +243,20 @@ public class ServiceException extends RuntimeException implements HttpResponse {
}
}
public static class UnexpectedErrorExpcetion extends ServiceException{
public static class UnexpectedErrorException extends ServiceException{
public UnexpectedErrorExpcetion(String message) {
public UnexpectedErrorException(String message) {
super(INTERNAL_SERVER_ERROR, message);
}
public UnexpectedErrorExpcetion(String message, Throwable throwable ) {
public UnexpectedErrorException(String message, Throwable throwable ) {
super(INTERNAL_SERVER_ERROR, message, throwable);
}
public UnexpectedErrorExpcetion(ErrorMessage errorMessage) {
public UnexpectedErrorException(ErrorMessage errorMessage) {
super(INTERNAL_SERVER_ERROR, errorMessage.message);
}
public UnexpectedErrorExpcetion(ErrorMessage errorMessage, Throwable throwable ) {
public UnexpectedErrorException(ErrorMessage errorMessage, Throwable throwable ) {
super(INTERNAL_SERVER_ERROR, errorMessage.message, throwable);
}
}

View File

@ -42,7 +42,7 @@ public class FreeStyleRunImpl extends AbstractRunImpl<FreeStyleBuild> {
run.doStop();
return new BlueRunStopResponse(getStateObj(), getResult());
} catch (Exception e) {
throw new ServiceException.UnexpectedErrorExpcetion("Error while trying to stop run", e);
throw new ServiceException.UnexpectedErrorException("Error while trying to stop run", e);
}
}
}

View File

@ -41,7 +41,7 @@ public class LogResource{
}
writeLogs(req, rsp);
} catch (IOException e) {
throw new ServiceException.UnexpectedErrorExpcetion("Failed to get log: " + e.getMessage(), e);
throw new ServiceException.UnexpectedErrorException("Failed to get log: " + e.getMessage(), e);
}
}

View File

@ -2,7 +2,6 @@ package io.jenkins.blueocean.service.embedded.rest;
import org.kohsuke.stapler.WebMethod;
import org.kohsuke.stapler.json.JsonBody;
import org.kohsuke.stapler.json.JsonResponse;
import org.kohsuke.stapler.verb.PUT;
import hudson.model.Job;
@ -51,7 +50,7 @@ public class MultiBranchPipelineImpl extends BlueMultiBranchPipeline {
Job job = mbp.getBranch("master");
if(job == null) {
throw new ServiceException.UnexpectedErrorExpcetion("no master branch to favorite");
throw new ServiceException.UnexpectedErrorException("no master branch to favorite");
}
FavoriteUtil.favoriteJob(job, favoriteAction.isFavorite());

View File

@ -32,13 +32,13 @@ public class FavoriteUtil {
//TODO: FavoritePlugin is null
FavoritePlugin plugin = Jenkins.getInstance().getPlugin(FavoritePlugin.class);
if(plugin == null) {
throw new ServiceException.UnexpectedErrorExpcetion("Can not find instance of favorites plugin");
throw new ServiceException.UnexpectedErrorException("Can not find instance of favorites plugin");
}
if(favorite != set) {
try {
plugin.doToggleFavorite(Stapler.getCurrentRequest(), Stapler.getCurrentResponse(), job.getFullName(), Jenkins.getAuthentication().getName(), false);
} catch (IOException e) {
throw new ServiceException.UnexpectedErrorExpcetion("Something went wrong setting the favorite", e);
throw new ServiceException.UnexpectedErrorException("Something went wrong setting the favorite", e);
}
}
}

View File

@ -40,7 +40,7 @@ public class Utils {
}
return (T) ImmutableSet.of(set);
}else{
throw new ServiceException.UnexpectedErrorExpcetion(
throw new ServiceException.UnexpectedErrorException(
String.format("Unknown type %s", type));
}
}catch (NumberFormatException e){