# \#exceptions

**URL:** https://discuss.ocaml.org/tag/exceptions/314.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [Aborting cleanly in C code when \`caml\_callback\*\_exn()\` returns an exception](https://discuss.ocaml.org/t/aborting-cleanly-in-c-code-when-caml-callback-exn-returns-an-exception/18678)

<div class="topic-metadata">

**Author:** [@SylvainBoilard](https://discuss.ocaml.org/u/SylvainBoilard)\
**Replies:** 2\
**Last updated:** [November 5, 2026, 6:16pm UTC](https://discuss.ocaml.org/t/aborting-cleanly-in-c-code-when-caml-callback-exn-returns-an-exception/18678 "2026-11-05T18:16:10Z")

</div>

Hi, I am maintaining a binding for the GLFW library, which provides an API for registering callback functions to be used for event handling. In order to make these kind of features available in OCaml, I use closures pro…

---

## [Error handling regarding dimension mismatch: Using invalid\_arg?](https://discuss.ocaml.org/t/error-handling-regarding-dimension-mismatch-using-invalid-arg/17923)

<div class="topic-metadata">

**Author:** [@jbe](https://discuss.ocaml.org/u/jbe)\
**Replies:** 8\
**Last updated:** [March 25, 2026, 7:04pm UTC](https://discuss.ocaml.org/t/error-handling-regarding-dimension-mismatch-using-invalid-arg/17923 "2026-03-25T19:04:12Z")

</div>

I’ve recently been working with vectors (using immutable arrays). At several places in my code, I would like to ensure that the dimensions of my vectors match. Continuing the discussion from Partial match: Style advice: …

---

## [\[BLOG\] OCaml Backtraces on Uncaught Exceptions, by OCamlPro](https://discuss.ocaml.org/t/blog-ocaml-backtraces-on-uncaught-exceptions-by-ocamlpro/14551)

<div class="topic-metadata">

**Author:** [@OCamlPro](https://discuss.ocaml.org/u/OCamlPro)\
**Replies:** 13\
**Last updated:** [May 23, 2024, 10:58pm UTC](https://discuss.ocaml.org/t/blog-ocaml-backtraces-on-uncaught-exceptions-by-ocamlpro/14551 "2024-05-23T22:58:32Z")

</div>

Greetings Cameleers, Here’s another one of our heads up about our latest blog release! Today’s topic is about an unintentionally hidden feature of the OCaml dev environmment: backtraces on uncaught exception! We beli…

---

## [Should out-of-memory ever be caught in libraries/framework?](https://discuss.ocaml.org/t/should-out-of-memory-ever-be-caught-in-libraries-framework/10712)

<div class="topic-metadata">

**Author:** [@raphael-proust](https://discuss.ocaml.org/u/raphael-proust)\
**Replies:** 27\
**Last updated:** [March 27, 2024, 2:23pm UTC](https://discuss.ocaml.org/t/should-out-of-memory-ever-be-caught-in-libraries-framework/10712 "2024-03-27T14:23:34Z")

</div>

What use cases are there for catching Out\_of\_memory? What about Stack\_overflow? Should a library ever catch those exceptions? Should a framework ever catch those exceptions? As a more concrete question, should Lwt eve…

---

## [Exception vs Result](https://discuss.ocaml.org/t/exception-vs-result/6931)

<div class="topic-metadata">

**Author:** [@cemerick](https://discuss.ocaml.org/u/cemerick)\
**Replies:** 60\
**Last updated:** [September 15, 2023, 12:21am UTC](https://discuss.ocaml.org/t/exception-vs-result/6931 "2023-09-15T00:21:43Z")

</div>

Last week, @BikalGurung blogged On Effectiveness of Exceptions in OCaml, in part as a follow-up to his announcement of his parser combinator library reparse, which eschews Result-based error handling in favor of exceptio…

---

## [Type of parameterized class is not bound within methods](https://discuss.ocaml.org/t/type-of-parameterized-class-is-not-bound-within-methods/9618)

<div class="topic-metadata">

**Author:** [@stw](https://discuss.ocaml.org/u/stw)\
**Replies:** 4\
**Last updated:** [April 3, 2022, 8:45pm UTC](https://discuss.ocaml.org/t/type-of-parameterized-class-is-not-bound-within-methods/9618 "2022-04-03T20:45:02Z")

</div>

Defining a local exception or module using the type of the parameterized class is not possible as the type is not bound. See this minimal example: class \['a\] foo = object method bar : unit = (\* Neither of th…

---

## [Lwt\_io catching exception issue](https://discuss.ocaml.org/t/lwt-io-catching-exception-issue/7702)

<div class="topic-metadata">

**Author:** [@maiste](https://discuss.ocaml.org/u/maiste)\
**Replies:** 1\
**Last updated:** [April 19, 2021, 1:39pm UTC](https://discuss.ocaml.org/t/lwt-io-catching-exception-issue/7702 "2021-04-19T13:39:21Z")

</div>

Hi, I’m trying to execute ls on a distant machine using Lwt\_process, Lwt\_io and Lwt\_stream. The code to read the directory is the following: let readdir\_aux ~remote dir = let cmd = Format.sprintf "ls -1 %s" d…

---

## [Best practices for exception handling](https://discuss.ocaml.org/t/best-practices-for-exception-handling/4012)

<div class="topic-metadata">

**Author:** [@ejgallego](https://discuss.ocaml.org/u/ejgallego)\
**Replies:** 5\
**Last updated:** [July 2, 2019, 2:19am UTC](https://discuss.ocaml.org/t/best-practices-for-exception-handling/4012 "2019-07-02T02:19:33Z")

</div>

Dear all, in Coq we would like to modernize our exception handling a bit. Coq’s codebase predates many modern OCaml constructions and thus we have some overlap with existing functionality. In particular, we have: the…
