AdaCore / AdaCore/learn

"Handling an exception" - "Attention" block

Open
#892 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

editorial Feedback
Dominant language
Ada
Stars
117
Forks
49
Avg merge
44m
Merged PRs (30d)
8

Description

The "Attention" block states that exceptions raised in declarative sections "are not caught by the handlers of that block." Based on the descriptions provided and the example code, there is no handler applied to the declarative section, so this makes sense. The handler is applied to a call in the procedure body. Had Dangerous been called in the procedure body, with the handler applied, the exception would have been caught.

Would it be more appropriate to say: exception handlers cannot be applied to anything in the declaration block (and thus, exceptions raised there would not be caught)? It seems like this might be the intent, but that's not what is stated here.

REF: Learn.ada link

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Learn.Ada exceptions chapter and locate the “Handling an exception” example and its “Attention” block. Compare the wording with the example’s handler scope, then revise the explanation so it accurately describes exceptions raised in the declaration block; the chapter should clearly match the behavior shown by the code.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.