iamsteveholmes
08/04/2022, 4:21 AMhttps://www.youtube.com/watch?v=NEc8PWNKlo0▾
Kristian Nedrevold
08/04/2022, 12:46 PMval responseData: ReservedCitizenResponse = response.body()
. If there is something wrong in the response body this will just crash with an JsonDecodingException as an unchecked exception. It would be nice if the .body() function returned a Result monad so you could handle the cases of successful and unsuccessful serialization.Stylianos Gakis
08/08/2022, 9:29 AMApplicationScope
like
class ApplicationScope(applicationScope: CoroutineScope) : CoroutineScope by applicationScope
// Then provided like
@Bean
fun applicationScope(): ApplicationScope {
return ApplicationScope(CoroutineScope(SupervisorJob() + <http://Dispatchers.IO|Dispatchers.IO>))
}
then converted an existing function to be fire-and-forget by using `launch`:
fun doSomething(...) = applicationScope.launch {...}
When an unhandled exception is thrown in the coroutine, somehow it doesn’t follow the normal logging/formatting process. Instead of a single error line in the log, we get each line in the stacktrace showing up as a separate line in the logs. This then shows up in the timeline as a whole lot of errors (50-100+) occurring at the same time.
Has someone who uses this combination of coroutines-slf4j-datadog experienced this before?
Could it be that the logger is not picking up these unhandled exceptions and it’s logging to the console? Or maybe we need to add something special to the ApplicationScope
to get SLF4J/Datadog to parse/format this error properly?Anshi
08/16/2022, 1:19 PMAugust Lilleaas
08/22/2022, 10:43 AMis
checks and delegation from a class to an object. Ktor has an extension function on ApplicationRequest
that uses when(this)
to check if the request is
a ServletApplicationRequest
. The problem is that the actual request object that I call the extension function on, is a RoutingApplicationRequest
, which is a class that delegates to the original request object. Which in turn causes is ServletApplicationRequest
to be false, as is
only seems to check class inheritance hierarchies, and not delegation. Is there a way to work around this? Or is it an issue/bug that Ktor needs to handle differently to work as expected?
FYI, here’s the full extension function:
public val ApplicationRequest.javaSecurityPrincipal: Principal?
get() = when (this) {
is ServletApplicationRequest -> servletRequest.userPrincipal
else -> null
}
and here’s the class that the instance of the request object is a member of:
public class RoutingApplicationRequest(
override val call: RoutingApplicationCall,
override val pipeline: ApplicationReceivePipeline,
request: ApplicationRequest
) : ApplicationRequest by request
rrva
08/24/2022, 3:06 PMDavdF
08/24/2022, 4:26 PMSlackbot
08/24/2022, 10:43 PMParesh Prajapati
08/30/2022, 10:34 AMParesh Prajapati
08/30/2022, 10:35 AMParesh Prajapati
08/30/2022, 10:36 AMRicardo Fernandes
09/01/2022, 7:20 PMYogeshvu
09/02/2022, 3:53 PMAbdullah Samir
09/06/2022, 11:52 AMCarlos Valencia
09/16/2022, 6:40 AMAndrew Louis
09/16/2022, 2:31 PMMilton Johansson
09/20/2022, 6:17 AMSlackbot
09/25/2022, 2:53 PMErik Dreyer
09/27/2022, 7:05 PMe
in the main()
function determines the return type of the dispatch()
function.
The error I’m getting is:
Type mismatch.
Required:
Result<E>
Found:
Result<ExampleEvent>
Bence Erős
10/02/2022, 5:57 PMYogeshvu
10/07/2022, 4:59 PMval retrievedResource: Mono<String> = myRequest
.retrieve()
.onStatus(HttpStatus::is4xxClientError) { Mono.error(RuntimeException("4XX Error ${it.statusCode()}, ${it.bodyToMono(String::class.java)}")) }
.onStatus(HttpStatus::is5xxServerError) { Mono.error(RuntimeException("5XX Error ${it.statusCode()}, ${it.bodyToMono(String::class.java)}")) }
.bodyToMono(String::class.java)
return retrievedResource.share().block()
João Esperancinha
10/11/2022, 6:13 PMAbdullah Samir
10/13/2022, 4:22 PMParesh Prajapati
10/14/2022, 12:09 PMOleg Shuliak
10/18/2022, 6:41 AMworkflowService.findByCompanyId
, that returns data class:
data class WorkflowWithStatusLookup(val workflow: Workflow, val status: Result<WorkflowStatus>)
also, I’d like to log the exception based on the “invalid” result of the status. Here is want I’ve came up with, but I’m pretty sure it’s not optimal way
override fun listWorkflow(featureToggles: FeatureToggles): ResponseEntity<GetWorkflowsResponse> {
return runBlocking(requestContext.coroutineContext) {
val (valid, invalid) = workflowService.findByCompanyId(getCompanyId(), featureToggles)
.partition { it.status.isSuccess }
val apiResponseModel = valid.map {
it.workflow.toWorkflowInfoResponse(it.status.getOrThrow())
}
return@runBlocking if (invalid.isEmpty()) {
ResponseEntity(
GetWorkflowsResponse(
data = apiResponseModel
),
HttpStatus.OK
)
} else {
ResponseEntity(
GetWorkflowsResponse(
data = apiResponseModel,
meta = invalid.map { it.workflow.name }
),
HttpStatus.PARTIAL_CONTENT
).also {
invalid.forEach {
throw FormNotFound(
it.workflow.definition.trigger.entityId!!.toString(),
it.workflow.companyId
)
}
}
}
}
}
Justin Xu
10/19/2022, 4:47 AMObjectIdImpl is not registered for polymorphic serialization in the scope of ObjectId
when using a custom serializerSimon
10/19/2022, 6:27 PMAvi Perl
10/27/2022, 8:07 PMmike.holler
10/28/2022, 4:08 PMconst val
and cannot be val
). Does anybody have any suggestions? The test below fails right now, but I'd like to make it pass by only adding code. I'd love to use .trimIndent()
when declaring myString
but I can't. Is there something I can use that the compiler will unfold?
const val myString = """
This is my string. I wrap it across multiple lines when it
becomes too long, but there should be no lines visible when
using this string. In other words, the newlines should be
compiled out of this string, and the margin collapsed. Is
there any compiler plugin I can use that can help make this
a reality?
"""
class ExampleTest {
@Test
fun `precompiled multi-line string has no newlines`() {
expectThat(myString).doesNotContain('/n')
}
}
Eli
10/29/2022, 10:41 AMEli
10/29/2022, 10:41 AMRon S
10/29/2022, 10:56 AMEli
10/29/2022, 11:04 AMRon S
10/29/2022, 11:15 AM