Stop installing librairies during tests
[parser.git] / verigraph / src / it / polito / verigraph / exception / GenericExceptionMapper.java
1 /*******************************************************************************
2  * Copyright (c) 2017 Politecnico di Torino and others.
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Apache License, Version 2.0
6  * which accompanies this distribution, and is available at
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *******************************************************************************/
9 package it.polito.verigraph.exception;
10
11 import javax.ws.rs.core.Response;
12 import javax.ws.rs.core.Response.Status;
13 import javax.ws.rs.ext.ExceptionMapper;
14
15 import it.polito.verigraph.model.ErrorMessage;
16
17 // @Provider
18 public class GenericExceptionMapper implements ExceptionMapper<Throwable> {
19
20     @Override
21     public Response toResponse(Throwable exception) {
22         ErrorMessage errorMessage = new ErrorMessage("Generic exception: " + exception.getMessage(),
23                 500,
24                 "http://localhost:8080/verigraph/api-docs/");
25         return Response.status(Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
26     }
27
28 }