Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Last active Oct 24, 2021
Embed
What would you like to do?
throwing exception
fun findEmployeeByName(name: String): Employee {
val request = Request(Method.GET, "http://myservice.org/employees").query("name", name)
val response: Response = client(request)
if (response.status == Status.OK) {
return Employee(response.bodyString())
}
throw RuntimeException("Could not find employee $name!")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment