could you merge the two error case in one?
case eb:EmptyBox => 
  val e = eb ?~! "Could not fetch policy server details (id ${sm.node.main.policyServerId}) for node with id ${sm.node.main.id}"
  logger.error(e.messageChain)
  e.rootExceptionCause.foreach { ex => logger.error("Exception was:", ex)
  <span class="error"><b>Rudder Policy Server: </b>Could not fetch details about the policy server</span> 


Or something like that ?