package edu.teco.dnd.module.messages.loadStartBlock;

import java.util.UUID;

import edu.teco.dnd.module.ModuleApplicationManager;
import edu.teco.dnd.network.ConnectionManager;
import edu.teco.dnd.network.MessageHandler;
import edu.teco.dnd.network.messages.Response;

public class BlockMessageHandler implements MessageHandler<BlockMessage> {
	final ModuleApplicationManager appManager;

	public BlockMessageHandler(ModuleApplicationManager appManager) {
		this.appManager = appManager;
	}

	@Override
	public Response handleMessage(ConnectionManager connMan, UUID remoteUUID, BlockMessage message) {
		if (appManager.scheduleBlock(message.getApplicationID(), message.block, message.scheduleToId)) {
			return new BlockAck();
		} else {
			return new BlockNak();
		}

	}

}

@@ -602,12 +602,17 @@
 %7B%0A%09%09
-if (
+try %7B%0A%09%09%09
 appM
@@ -700,46 +700,33 @@
 oId)
-) %7B%0A%09%09%09return new BlockAck();%0A%09%09%7D else
+;%0A%09%09%7D catch (Exception e)
  %7B%0A%09
@@ -754,15 +754,38 @@
 ();%0A%09%09%7D%0A
+%09%09return new BlockAck();
 %0A%09%7D%0A
-%0A
 %7D%0A

Rewrite handler to work with exceptions instead of returned booleans.