Added better error handling for spring environment issues
This commit is contained in:
parent
b72060cd2a
commit
707b8a1b26
@ -176,8 +176,15 @@ class GroupSessionController {
|
||||
retryCount++
|
||||
Thread.sleep(1_000) // Sleep for 1 second
|
||||
}
|
||||
if (ipv4 != null)
|
||||
if (ipv4 != null && this::environment.isInitialized)
|
||||
return mapOf("ip" to ipv4, "port" to environment["local.server.port"])
|
||||
else if(ipv4 == null) {
|
||||
logger.error("IP Address could not be determined")
|
||||
return mapOf("error" to "Could not determine IP Address")
|
||||
}
|
||||
else {
|
||||
logger.error("Port could not be determined, environment not initialised")
|
||||
return mapOf("error" to "Could not determine port")
|
||||
}
|
||||
}
|
||||
}
|
@ -30,12 +30,10 @@ class GroupSessionControllerTest{
|
||||
lateinit var siteRepository: SiteRepository
|
||||
@Mock
|
||||
lateinit var tutorRepository: TutorRepository
|
||||
/**
|
||||
@Mock
|
||||
lateinit var observationRepository: ObservationRepository
|
||||
@Mock
|
||||
lateinit var personRepository: PersonRepository
|
||||
**/
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
|
Loading…
Reference in New Issue
Block a user