by

How to get as String the full stack of a exception in your application

<dependency>
  <groupId>commons-lang</groupId>
  <artifactId>commons-lang</artifactId>
  <version>2.2</version>
</dependency>
//sample of code
try {
     List<Veiculo> result = veiculoService.findAllVeiculos();
 
     List<Veiculo> listaNova = null;
 
     listaNova.add(result.get(0));
     listaNova.add(result.get(1));
     listaNova.add(result.get(2));
 
     msg.reply(Json.encode(listaNova));

 } catch (Exception e) { 
     String msgError = ExceptionUtils.getFullStackTrace(e);

     msg.fail(MessageCode.INTERNAL_SERVER_ERROR, msgError);
 }

Escreva um comentário

Comment