# exceptions

An exception is an event or error condition during program execution that disrupts normal instruction flow and is passed to a handler or up the call stack.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## KotlinConf 2025 Announcements

DevFeed: [KotlinConf 2025 Announcements](<https://devfeed.tech/articles/kotlinconf-2025-announcements-39349.md>)

Original publisher: [Read original article](<https://kt.academy/article/kotlinconf2025-announcements>)

Published: 2025-06-03T00:00:00Z

Content type: article

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [destructuring](<https://devfeed.tech/topics/destructuring.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [union types](<https://devfeed.tech/topics/union-types.md>), [syntax](<https://devfeed.tech/topics/syntax.md>), [Safe-Call Operator](<https://devfeed.tech/topics/safe-call-operator.md>)

Tags: [announcements](<https://devfeed.tech/tags/announcements.md>), [destructuring](<https://devfeed.tech/tags/destructuring.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlinconf](<https://devfeed.tech/tags/kotlinconf.md>), [new-features](<https://devfeed.tech/tags/new-features.md>), [safe-call-operator](<https://devfeed.tech/tags/safe-call-operator.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [union-types](<https://devfeed.tech/tags/union-types.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

The article summarizes announcements from KotlinConf 2025, including K2 becoming stable, upcoming name-based destructuring, and rich errors with language-level support for result-or-error types and related operators.

### Source excerpt

The greatest announcements from KotlinConf 2025.

## Kotlin and Java interoperability: Traps and gotchas

DevFeed: [Kotlin and Java interoperability: Traps and gotchas](<https://devfeed.tech/articles/kotlin-and-java-interoperability-traps-and-gotchas-39204.md>)

Original publisher: [Read original article](<https://kt.academy/article/ak-java-interop-4>)

Published: 2023-08-21T00:15:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [interoperability](<https://devfeed.tech/topics/interoperability.md>), [Java](<https://devfeed.tech/topics/java.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [gotchas](<https://devfeed.tech/topics/gotchas.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>)

Tags: [gotchas](<https://devfeed.tech/tags/gotchas.md>), [interoperability](<https://devfeed.tech/tags/interoperability.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [mockito](<https://devfeed.tech/tags/mockito.md>), [unit-test](<https://devfeed.tech/tags/unit-test.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This tutorial explains surprising aspects of Kotlin and Java interoperability, including return types, function types and functional interfaces, Java keywords used in Kotlin names, Mockito's `when` function, Kotlin/JVM naming constraints, and Java checked exceptions.

### Source excerpt

The parts of Kotlin and Java interoperability that might be surprising or counterintuitive.

## Always use feenableexcept() when doing floating point math

DevFeed: [Always use feenableexcept() when doing floating point math](<https://devfeed.tech/articles/always-use-feenableexcept-when-doing-floating-point-math-36251.md>)

Original publisher: [Read original article](<https://berthub.eu/articles/posts/always-do-this-floating-point/>)

Published: 2022-12-24T20:28:43Z

Content type: tutorial

Language: en

Sources: [Bert Hubert's writings](<https://devfeed.tech/sources/bert-hubert-s-writings.md>)

Topics: [floating-point](<https://devfeed.tech/topics/floating-point.md>), [C](<https://devfeed.tech/topics/c.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [gcc](<https://devfeed.tech/topics/gcc.md>), [Linux](<https://devfeed.tech/topics/linux.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [floating-point](<https://devfeed.tech/tags/floating-point.md>), [linux](<https://devfeed.tech/tags/linux.md>), [math](<https://devfeed.tech/tags/math.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

This tutorial explains how floating-point exceptions, infinities, and NaNs can occur silently in C and C++ programs, especially under compiler optimization. It describes enabling floating-point exceptions under Linux with feenableexcept() and notes remaining issues involving SIMD optimization.

### Source excerpt

This is a refreshed & expanded copy of a very old page I hosted outside of this blog. I recently ran into "silent NaNs" again, and thought it might be a good idea to republish this advice here. A small post that documents something that almost no one appears to know. And if you do anything with floating point, you do need to know. Exceptions In C or C++, try this:

## Effective Kotlin Item 7: Prefer a nullable or Result result type when the lack of a result is possible

DevFeed: [Effective Kotlin Item 7: Prefer a nullable or Result result type when the lack of a result is possible](<https://devfeed.tech/articles/effective-kotlin-item-7-prefer-a-nullable-or-result-result-type-when-the-lack-of-a-result-is-possible-39285.md>)

Original publisher: [Read original article](<https://kt.academy/article/ek-nullable-result>)

Published: 2022-10-19T00:00:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [Exception](<https://devfeed.tech/topics/exception.md>)

Tags: [avoid](<https://devfeed.tech/tags/avoid.md>), [exception](<https://devfeed.tech/tags/exception.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This Kotlin article explains when to return nullable or Result types and when to throw exceptions. It recommends explicit return types for expected failures because they are clearer and more efficient to handle, while exceptions should be reserved for unexpected or exceptional conditions. It also notes reasonable uses of exceptions in some backend and Android processing patterns.

### Source excerpt

Why should we prefer to avoid throwing exceptions and using types to our advantage.

## In-Process Patchless AMSI Bypass

DevFeed: [In-Process Patchless AMSI Bypass](<https://devfeed.tech/articles/in-process-patchless-amsi-bypass-32633.md>)

Original publisher: [Read original article](<https://ethicalchaos.dev/2022/04/17/in-process-patchless-amsi-bypass/>)

Author: CCob

Published: 2022-04-17T16:30:25Z

Content type: tutorial

Language: en

Sources: [Ethical Chaos](<https://devfeed.tech/sources/ethical-chaos.md>)

Topics: [Windows](<https://devfeed.tech/topics/windows.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [debug](<https://devfeed.tech/topics/debug.md>), [C2](<https://devfeed.tech/topics/c2.md>), [Processes](<https://devfeed.tech/topics/processes.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [breakpoint](<https://devfeed.tech/tags/breakpoint.md>), [bypass](<https://devfeed.tech/tags/bypass.md>), [c2](<https://devfeed.tech/tags/c2.md>), [context](<https://devfeed.tech/tags/context.md>), [debugger](<https://devfeed.tech/tags/debugger.md>), [edr](<https://devfeed.tech/tags/edr.md>), [exception](<https://devfeed.tech/tags/exception.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [execution](<https://devfeed.tech/tags/execution.md>), [extension](<https://devfeed.tech/tags/extension.md>), [windows](<https://devfeed.tech/tags/windows.md>)

### AI overview

This article explains an in-process, patchless AMSI bypass approach using vectored exception handling. It contrasts this technique with SharpBlock's debugger-based child-process method and describes manipulating thread context at the point an exception occurs.

### Source excerpt

Some of you may remember my patchless AMSI bypass article and how it was used inside SharpBlock to bypass AMSI on the child process that SharpBlock spawns. This is all well a good when up against client environments that are not too sensitive to the fork and run post exploitation model of operating. What about [...] The post In-Process Patchless AMSI Bypass appeared first on Ethical Chaos.

## Casting in Python and Redis

DevFeed: [Casting in Python and Redis](<https://devfeed.tech/articles/casting-in-python-and-redis-28232.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/python/2020/03/08/casting-in-python-and-redis.html>)

Author: Fuzzygroup

Published: 2020-03-08T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Redis](<https://devfeed.tech/topics/redis.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [debugging](<https://devfeed.tech/topics/debugging.md>)

Tags: [debugging](<https://devfeed.tech/tags/debugging.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [filesystem](<https://devfeed.tech/tags/filesystem.md>), [import](<https://devfeed.tech/tags/import.md>), [linux](<https://devfeed.tech/tags/linux.md>), [python](<https://devfeed.tech/tags/python.md>), [redis](<https://devfeed.tech/tags/redis.md>)

### AI overview

A debugging account of a Python and Redis WRONGTYPE error caused by byte-string conversion. The author reports that wrapping Redis list names and values with str() resolved the operation, and that decoding byte ranges with UTF-8 was relevant to the string-conversion issue.

### Source excerpt

I recently had this situation in Python and Redis: redis.lpush(kafka_topic_name, current_filename) redis.exceptions.ResponseError: WRONGTYPE Operation against a key holding the wrong kind of value So I did my normal deal of debugging by adding: import pdb and then a: pdb.set_trace() before the lpush call and I tried it manually by typing out redis.lpush(kafka_topic_name, current_filename) ENTER and it, naturally, worked fine. Grumble. What I finally ended up doing is wrapping a str() call as follows: redis.lpush(str(kafka_topic_name), (current_filename)) And that let things work correctly. In talking with another Python programmer, we came to the conclusion that Python's auto casting of things between byte literals and strings was the culprit. Wrapping a str() call around both the list name and the list value solved things nicely. Note: I figured this out by moving from a lpush operation on Redis to a sadd operation and then retrieving back a single entry which showed me the Python b prefix: b'/Users/sjohnson/Sync/fuzzygroup/adl/ohi_kafka/experts-all/data/twitter/25400bcd1142564b4476c178935bd736.json' Also - Don't Forget About Unicode I dug into this further and a least part of this issue for string conversion from Python byte ranges into actual strings is that you need to use a current_filename.decode("utf-8") call because the Python byte range has no idea what the encoding was. Now I will admit that I'm surprised that Python didn't realize "Ok we're reading data from the filesystem's dir() operation" and it is OS-X so the encoding must be XYZ (utf-8 I would think). Here's an example of this: >>> import sys >>> sys.stdout.encoding 'UTF-8' And since my coworker on this project uses Linux, I guess I need to embed that into my application (note - it isn't 100% clear to me that sys.stdout.encoding is the same as the encoding of the filesystem's directory output; there is also the sys.setdefaultencoding('utf-8') call). See Also: Stack Overflow 1 Stack Overflow 2 Related

## Why Some Applications Should Crash on Unhandled Exceptions

DevFeed: [Why Some Applications Should Crash on Unhandled Exceptions](<https://devfeed.tech/articles/why-your-app-should-crash-28655.md>)

Original publisher: [Read original article](<https://jeroenmols.com/blog/2017/03/08/appcrash/>)

Author: info@jeroenmols.com (Jeroen Mols)

Published: 2017-03-08T00:00:00Z

Content type: opinion

Language: en

Sources: [Jeroen Mols](<https://devfeed.tech/sources/jeroen-mols.md>)

Topics: [App](<https://devfeed.tech/topics/app.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [app](<https://devfeed.tech/tags/app.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [blogs](<https://devfeed.tech/tags/blogs.md>), [cleancode](<https://devfeed.tech/tags/cleancode.md>), [code](<https://devfeed.tech/tags/code.md>), [crash](<https://devfeed.tech/tags/crash.md>), [crashes](<https://devfeed.tech/tags/crashes.md>), [developers](<https://devfeed.tech/tags/developers.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [issue](<https://devfeed.tech/tags/issue.md>), [notify](<https://devfeed.tech/tags/notify.md>), [production](<https://devfeed.tech/tags/production.md>), [state](<https://devfeed.tech/tags/state.md>), [tips](<https://devfeed.tech/tags/tips.md>), [trace](<https://devfeed.tech/tags/trace.md>)

### AI overview

This article argues that applications should sometimes crash when they reach an unsupported state. It uses null checks as an example, explaining that excessive checks can clutter code and conceal deeper issues, while unhandled exceptions can expose problems through crashes, traces, and crash reporting.

### Source excerpt

Too many times I've seen developers trying to avoid crashes at all cost. But are unhandled exceptions really that bad? And are null checks really the answer?

## Failjure: Exception-free error handling for Clojure

DevFeed: [Failjure: Exception-free error handling for Clojure](<https://devfeed.tech/articles/failjure-exception-free-error-handling-for-clojure-32137.md>)

Original publisher: [Read original article](<https://adambard.com/blog/introducing-failjure/>)

Published: 2016-01-30T00:00:00Z

Content type: release

Language: en

Sources: [Adam Bard](<https://devfeed.tech/sources/adam-bard.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [Error Handling](<https://devfeed.tech/topics/error-handling.md>), [Library](<https://devfeed.tech/topics/library.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>)

Tags: [clojure](<https://devfeed.tech/tags/clojure.md>), [error-handling](<https://devfeed.tech/tags/error-handling.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [library](<https://devfeed.tech/tags/library.md>), [monad](<https://devfeed.tech/tags/monad.md>)

### AI overview

The article introduces Failjure, a Clojure utility library for exception-free error handling. It describes returning failure values instead of throwing exceptions, short-circuiting with built-in helpers, wrapping exceptions as failures, and distinguishing expected faults from unexpected errors.

### Source excerpt

I've written before about handling errors in Clojure without using exceptions, by making use of ad-hoc monads. In that post, I also referenced Andrew Brehaut's error monad implementation. Since then, I've written a number of projects that use similar handling, and I thought the time had come to wrap it up in a library, which I'm calling Failjure.

## Why Try - Java 8 lambdas and checked Exceptions

DevFeed: [Why Try - Java 8 lambdas and checked Exceptions](<https://devfeed.tech/articles/why-try-java-8-lambdas-and-checked-exceptions-32001.md>)

Original publisher: [Read original article](<https://tech.finn.no2016/01/20/why-try-java-8-functional-programming/>)

Author: Sjur Millidahl

Published: 2016-01-20T07:13:00Z

Content type: tutorial

Language: en

Sources: [Finn.no](<https://devfeed.tech/sources/finn-no.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [Scala](<https://devfeed.tech/topics/scala.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [functional](<https://devfeed.tech/tags/functional.md>), [java](<https://devfeed.tech/tags/java.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [scala](<https://devfeed.tech/tags/scala.md>)

### AI overview

This tutorial explains how checked exceptions complicate Java 8 lambdas. It presents FINN.no's open source Try structure, inspired by Scala's Try, to represent computations as Success or Failure and simplify mapping, flat-mapping, and recovery.

### Source excerpt

Why won't this compile? (And why does riskyTask throw a PrinterException?!) One does not have to use lambdas in Java 8 long before running into the obstacle of checked Exceptions. Because the PrinterException is checked, the compiler forces us to deal with it, even within a lambda: private void demonstrate() { IntStream ones = IntStream.generate(() -> 1); ones.map(i -> { try { return riskyTask(i); } catch (PrinterException e) { System.out.println( "Your printer is out of ink or laser beams!" ); } return i; }); } private int riskyTask(int a) throws PrinterException { return 2; } But we don't like to do this. We use lambdas to express intent in a concise and elegant fashion. The try/catch-brackets feels like noise. For this reason, FINN.no's open source lambda-companion project introduces a useful structure for using lambdas in a world with checked Exceptions : Try. A Try represents a computation which might fail, and is always represented as a Success or a Failure (but never both). The concept borrows from Scala's Try, and shares several properties to other monadic functional structures : Future (completable success or failure) Optional (present or empty value) Either (one of two values) FINN.no's Try is right-biased, meaning that one can map and flatMap on a Try without having to add specific logic to handle a Try being a Failure; the computation will simply only take place if it is a Success. Using a Try we could refactor our riskyTask-example: private void demonstrate() { IntStream ones = IntStream.generate(() -> 1); Stream<Try<Integer>> tryStream = ones.mapToObj(this::riskyTask); tryStream.forEach(this::print); } private Try<Integer> riskyTask(int a) { return new Success<>(2); } private void print(Try<Integer> t) { Integer defaultNumber = 0; Integer i = t.recover(success -> success, failure -> defaultNumber); System.out.print(i); } This is contrived of course. And one should rarely accept a Try as a method argument. (And one should rarely generate an infinite str

## Java 8 workshop at Finn.no

DevFeed: [Java 8 workshop at Finn.no](<https://devfeed.tech/articles/java-8-workshop-at-finn-no-31990.md>)

Original publisher: [Read original article](<https://tech.finn.no2015/02/16/java-8-workshop-at-finnno/>)

Author: Sjur Millidahl

Published: 2015-02-16T07:50:16Z

Content type: tutorial

Language: en

Sources: [Finn.no](<https://devfeed.tech/sources/finn-no.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [coding style](<https://devfeed.tech/topics/coding-style.md>), [Code](<https://devfeed.tech/topics/code.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>)

Tags: [coding-style](<https://devfeed.tech/tags/coding-style.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [java](<https://devfeed.tech/tags/java.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [language](<https://devfeed.tech/tags/language.md>), [optional](<https://devfeed.tech/tags/optional.md>), [stream](<https://devfeed.tech/tags/stream.md>), [workshop](<https://devfeed.tech/tags/workshop.md>)

### AI overview

This article describes a two-part workshop at Finn.no on adopting Java 8's functional programming features. It covers streams and lambdas, then Optional and an in-house Either type for handling absent values and exceptions.

### Source excerpt

Pondering on the right lambda for the job With Java 8 comes a whole new set of language features. It even challenges the imperative coding-style of the Java programmer. Java is a core language in Finn.no. More and more of our java-modules are being built with Java 8, adopting new features of the language. A workshop was warranted, with the goal of bringing every developer up to speed on the functional paradigm of Java 8. In Finn.no, we want programmers to do stuff like this db.fetchLastDayAds() .stream() .filter(ad -> "bap-webstore".equals(ad.getAdType())) .flatMap(ad -> ad.getContacts().stream()) .distinct() .flatMap(per -> Optional.ofNullable(contact.getEmail()).map(Stream::of) .orElseGet(Stream::empty)) .peek(contact -> LOG.trace("Sending notification to "+per)) .forEach(this::sendNotification); While avoiding stuff like this IntStream.iterate(0, i -> (i + 1) % 2) .parallel() .distinct() .limit(10) .forEach(System.out::println); (Locking up all cores on a CPU is bad, and should only be done when the machine is right about to become self-aware and turn against you.) Several lambda-arrows pointing in the right direction here We split the workshop into two half days. The first day was dedicated to streams and lambdas. Everyone seemed keen on getting those tests green (a rhyme!). Day 2 we raised the bar with Optional and our in-house version of Either<L,R>. With these structures, much more code can be written functionally in a world where values might not exist (be null), and things may go wrong (throw exceptions). We need power.. lots of power! Both the word "monad" and the phrase "monadic domain" was uttered several times, but we still saw very few making the swoooosh-sound while flying a hand over their head (the internationally recognized sign of communicating that a topic is beyond mental capacity). This might mean that the timing was good, and developers are interested in the new features of Java 8. You may checkout the project and do the tasks yourself, by mak

## Using JUnit Rules to simplify your tests

DevFeed: [Using JUnit Rules to simplify your tests](<https://devfeed.tech/articles/using-junit-rules-to-simplify-your-tests-37795.md>)

Original publisher: [Read original article](<https://carlosbecker.com/posts/junit-rules/>)

Author: Carlos Alexandro Becker

Published: 2014-11-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [Carlos Becker](<https://devfeed.tech/sources/carlos-becker.md>)

Topics: [test](<https://devfeed.tech/topics/test.md>), [Code](<https://devfeed.tech/topics/code.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [interface](<https://devfeed.tech/topics/interface.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [interface](<https://devfeed.tech/tags/interface.md>), [junit](<https://devfeed.tech/tags/junit.md>), [mockito](<https://devfeed.tech/tags/mockito.md>), [simplify](<https://devfeed.tech/tags/simplify.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

This tutorial explains how to use JUnit Rules to reduce repeated setup and teardown code in tests. It covers timeouts, temporary folders, expected exceptions, custom rules, Mockito initialization, external resources, and integration-test server lifecycle management.

### Source excerpt

Have you ever written JUnit tests extending a class that does some before and after work, so you didn't have to repeat that code in various test classes?

## Error Handling in Clojure with Value-and-Error Results

DevFeed: [Error Handling in Clojure with Value-and-Error Results](<https://devfeed.tech/articles/good-enough-error-handling-in-clojure-32093.md>)

Original publisher: [Read original article](<https://adambard.com/blog/acceptable-error-handling-in-clojure/>)

Published: 2013-05-13T00:00:00Z

Content type: tutorial

Language: en

Sources: [Adam Bard](<https://devfeed.tech/sources/adam-bard.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [Error Handling](<https://devfeed.tech/topics/error-handling.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [function](<https://devfeed.tech/topics/function.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [clojure](<https://devfeed.tech/tags/clojure.md>), [code](<https://devfeed.tech/tags/code.md>), [error-handling](<https://devfeed.tech/tags/error-handling.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [function](<https://devfeed.tech/tags/function.md>), [monad](<https://devfeed.tech/tags/monad.md>)

### AI overview

This tutorial presents a pragmatic approach to error handling in Clojure by returning either a value or an error message instead of throwing exceptions. It progressively composes validators and ends with a simple error-monad-like pattern.

### Source excerpt

Writing Clojure is not like writing Java. In Java, exceptions are an accepted part of the workflow; in Clojure, they are begrudgingly supported out of necessity, but generally avoided. Why is that? Probably because writing code that throws exceptions makes your functional code a lot less functional - that is, a lot less composable. When you can't trust a function to execute and return a value you lose some functional purity.

## How to generate error log from nested exceptions.

DevFeed: [How to generate error log from nested exceptions.](<https://devfeed.tech/articles/how-to-generate-error-log-from-nested-exceptions-38414.md>)

Original publisher: [Read original article](<https://khmylov.com/2012/04/how-to-generate-error-log-from-nested-exceptions/>)

Author: Andrew Khmylov

Published: 2012-04-24T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Exception](<https://devfeed.tech/topics/exception.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [Code](<https://devfeed.tech/topics/code.md>), [Logging](<https://devfeed.tech/topics/logging.md>), [console](<https://devfeed.tech/topics/console.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [error](<https://devfeed.tech/tags/error.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [gist](<https://devfeed.tech/tags/gist.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [logging](<https://devfeed.tech/tags/logging.md>), [simple](<https://devfeed.tech/tags/simple.md>)

### AI overview

This code-focused tutorial demonstrates how to generate readable error logs from nested exceptions in C#. It recursively traverses inner exceptions and handles AggregateException by flattening its InnerExceptions collection.

### Source excerpt

Working on error logging for my new application I've realized that I always use the same pattern when it comes to converting actual exceptions into a text form. And since I started posting rare code snippets that I write down all the time on Gist recently, there will be a number of 'sharing code' blog posts in the foreseeable future. The code is rather simple, it traverses down the entire nested exception hierarchy and populates StringBuilder with the appropriate error information. There is a slightly different workflow for AggregateException - we want to flatten its InnerExceptions collection. public string GetExceptionLog(Exception exception) { return UnwrapExceptionTextLoop(new StringBuilder(), 0, exception); } private string UnwrapExceptionTextLoop(StringBuilder sb, int level, Exception e) { if (e == null) { return sb.ToString(); } for (int i = 0; i < level; i++) { sb.Append(">>"); } var aggregate = e as AggregateException; sb.AppendFormat("{0} - {1} [{2}] {3}", e.GetType(), aggregate == null ? e.Message : String.Empty, e.StackTrace, Environment.NewLine); if (aggregate != null) { return String.Join(Environment.NewLine, aggregate.InnerExceptions.Select(inner => UnwrapExceptionTextLoop(sb, level + 1, inner))); } return UnwrapExceptionTextLoop(sb, level + 1, e.InnerException); } Let's put on a simple method that throws several exceptions: public void TestMethod() { try { try { throw new Exception("Inner exception"); } catch (Exception ex) { throw new Exception("Outer exception"); } } catch (Exception ex) { Console.WriteLine(ErrorHelper.GetExceptionLog(ex)); } } And here is the result (I've omitted the large stack trace information): System.Exception - Outer exception [ at Client.App.TestMethod()..] >>System.Exception - Inner exception [ at Client.App.TestMethod()..]

## One Thing I Learned From F# (Nulls Are Bad)

DevFeed: [One Thing I Learned From F# (Nulls Are Bad)](<https://devfeed.tech/articles/one-thing-i-learned-from-f-nulls-are-bad-33390.md>)

Original publisher: [Read original article](<https://timkellogg.me/blog/2012/02/29/one-thing-i-learned-from-f-nulls-are>)

Published: 2012-02-29T00:00:00Z

Content type: opinion

Language: en

Sources: [Tim Kellogg](<https://devfeed.tech/sources/tim-kellogg.md>)

Topics: [F#](<https://devfeed.tech/topics/fsharp.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [C#](<https://devfeed.tech/topics/csharp.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [pattern matching](<https://devfeed.tech/topics/pattern-matching.md>), [Haskell](<https://devfeed.tech/topics/haskell.md>), [OCaml](<https://devfeed.tech/topics/ocaml.md>)

Tags: [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [f-sharp](<https://devfeed.tech/tags/f-sharp.md>), [functional](<https://devfeed.tech/tags/functional.md>), [pattern-matching](<https://devfeed.tech/tags/pattern-matching.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

The author reflects on learning F# while contributing to VsVim, highlighting pattern matching, discriminated unions, and F#'s option types. The article argues that using None and Some instead of null can make invalid states explicit and reduce null-related bugs.

### Source excerpt

Recently I started contributing to VsVim, a Visual Studio plugin that emulates Vim. When he was starting the project, Jared Parsons decided to write the bulk of it in F#. He did this mostly as a chance to learn a new language but also because it's a solid first class alternative to C#. For instance, F#'s features like pattern matching and discriminated unions are a natural fit for state machines like Vim.This is my first experience with a truly functional language. For those who aren't familiar with F#, it's essentially OCaml.NET (the F# book uses OCaml for it's markup syntax), but also draws roots from Haskell. It's a big mind shift from imperative and pure object oriented languages, but one I'd definitely recommend to any developer who wants to be better.Since I've been working on VsVim, I've been using F# in my spare time but C# in my regular day job. The longer I use F# the more I want C# to do what F# does. The biggest example is how F# handles nulls.In C# (and Ruby, Python, and any imperative language) most values can be null, and null is a natural state for a variable to be in. In fact (partly due to SQL), null is used whenever a value is empty or doesn't exist yet. In C# and Java, null is the default value for any member reference, you don't even need to explicitly initialize it. As a result, you often end up with a lot of null pointer exceptions due to sloppy programming. After all, it's kind of hard to remember to check for null every time you use a variable.In F#, nothing is null (that's not entirely true, but in it's natural state it's true enough). Typically you'll use options instead of null. For instance, if you have a function that fails to find or calculate something you might return null in imperative languages (and the actual value if successful). However, in F# you use an option type and return None on failure and Some value on success.Here, every time you call find(kittens) you get back an option type. This type isn't a string, so you can't just

## ReactOS fixes two serious PSEH exception-handling bugs

DevFeed: [ReactOS fixes two serious PSEH exception-handling bugs](<https://devfeed.tech/articles/newsletter-62-32928.md>)

Original publisher: [Read original article](<https://reactos.org/blogs/newsletter-62/>)

Published: 2009-07-21T00:00:00Z

Content type: news

Language: en

Sources: [Front Page on ReactOS Website](<https://devfeed.tech/sources/front-page-on-reactos-website.md>)

Topics: [ReactOS](<https://devfeed.tech/topics/reactos.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [Library](<https://devfeed.tech/topics/library.md>), [Kernel](<https://devfeed.tech/topics/kernel.md>), [gcc](<https://devfeed.tech/topics/gcc.md>)

Tags: [arm](<https://devfeed.tech/tags/arm.md>), [bug](<https://devfeed.tech/tags/bug.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [free](<https://devfeed.tech/tags/free.md>), [gcc](<https://devfeed.tech/tags/gcc.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [library](<https://devfeed.tech/tags/library.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [os](<https://devfeed.tech/tags/os.md>), [react](<https://devfeed.tech/tags/react.md>), [reactos](<https://devfeed.tech/tags/reactos.md>), [win32](<https://devfeed.tech/tags/win32.md>), [winapi](<https://devfeed.tech/tags/winapi.md>)

### AI overview

ReactOS developers found and fixed two serious bugs in the PSEH library. One mishandled nested try/catch blocks and could cause infinite loops, while the other caused random stack corruption when exceptions were raised.

### Source excerpt

PSEH Corruption In NT operating systems, structured exception handling is used to help safeguard probing of user mode memory buffers and pageable memory while in kernel mode. This requirement was what motivated the creation of the PSEH library by KJK::Hyperion since GCC does not have support for it. Since the last attempt to add SEH support to GCC failed, ReactOS remains dependent on PSEH. Recently, the ARM team committed some code which exposed a very nasty bug in the PSEH library and investigation of the issue led KJK to discover another bug while analyzing the code.

## ReactOS Newsletter 50: PSEH2 Exception Issues, MSVCRT Testing, and Win32k Initialization

DevFeed: [ReactOS Newsletter 50: PSEH2 Exception Issues, MSVCRT Testing, and Win32k Initialization](<https://devfeed.tech/articles/newsletter-50-32916.md>)

Original publisher: [Read original article](<https://reactos.org/blogs/newsletter-50/>)

Published: 2008-12-20T00:00:00Z

Content type: article

Language: en

Sources: [Front Page on ReactOS Website](<https://devfeed.tech/sources/front-page-on-reactos-website.md>)

Topics: [ReactOS](<https://devfeed.tech/topics/reactos.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [unit tests](<https://devfeed.tech/topics/unit-tests.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [WINE](<https://devfeed.tech/topics/wine.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [crash](<https://devfeed.tech/tags/crash.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [free](<https://devfeed.tech/tags/free.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [os](<https://devfeed.tech/tags/os.md>), [react](<https://devfeed.tech/tags/react.md>), [reactos](<https://devfeed.tech/tags/reactos.md>), [tests](<https://devfeed.tech/tags/tests.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>), [win32](<https://devfeed.tech/tags/win32.md>), [winapi](<https://devfeed.tech/tags/winapi.md>), [wine](<https://devfeed.tech/tags/wine.md>)

### AI overview

This ReactOS newsletter discusses data corruption and crashes associated with the relatively untested PSEH2 implementation, ongoing fixes and SEH test development, login input-component problems, MSVCRT compatibility work, and unit testing against Wine.

### Source excerpt

The Perils of PSEH2 While KJK did get PSEH2 out in record time, this meant that it was relatively untested when he committed it and developers began using it. Currently PSEH seems to be corrupting data when exceptions get thrown, which then cascades down and causes functions to assert and crash, something that it was supposed to prevent. Michael Martin's theory about what is happening is that PSEH is clobbering local variables that are being held in registers, though KJK attributes it to an issue of not using setjmp.