* ========================LICENSE_START=================================
* O-RAN-SC
* %%
- * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * Copyright (C) 2019 AT&T Intellectual Property
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.lang.invoke.MethodHandles;
+import org.oransc.ric.portal.dashboard.exception.UnknownInstanceException;
import org.oransc.ric.portal.dashboard.model.ErrorTransport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
}
+ /**
+ * Logs a warning if an invalid RIC instance key is used.
+ *
+ * @param ex
+ * The exception
+ * @param request
+ * The original request
+ * @return A response entity with status code 400
+ */
+ @ExceptionHandler({ UnknownInstanceException.class })
+ public final ResponseEntity<ErrorTransport> handleUnknownInstanceException(Exception ex, WebRequest request) {
+ log.warn("handleUnknownInstanceException: request {}, exception {}", request.getDescription(false),
+ ex.toString());
+ return new ResponseEntity<>(new ErrorTransport(400, ex), HttpStatus.BAD_REQUEST);
+ }
+
}