Skip to content

Commit ba248a9

Browse files
ovitrifclaude
andcommitted
chore: update ai rules for logger
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f5a3c15 commit ba248a9

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ fun updateState(action: Action) {
147147
```kotlin
148148
suspend fun getData(): Result<Data> = withContext(Dispatchers.IO) {
149149
runCatching {
150-
Result.success(apiService.fetchData())
151-
}.onFailure { e ->
152-
Logger.error("Failed", e = e, context = TAG)
150+
apiService.fetchData()
151+
}.onFailure {
152+
Logger.error("Failed", it, context = TAG)
153153
}
154154
}
155155
```
@@ -176,6 +176,7 @@ suspend fun getData(): Result<Data> = withContext(Dispatchers.IO) {
176176
- ALWAYS acknowledge datastore async operations run synchronously in a suspend context
177177
- NEVER use `runBlocking` in suspend functions
178178
- ALWAYS pass the TAG as context to `Logger` calls, e.g. `Logger.debug("message", context = TAG)`
179+
- NEVER add `e = ` named parameter to Logger calls
179180
- ALWAYS log errors at the final handling layer where the error is acted upon, not in intermediate layers that just propagate it
180181
- ALWAYS use the Result API instead of try-catch
181182
- NEVER wrap methods returning `Result<T>` in try-catch

0 commit comments

Comments
 (0)