Skip to content

error message for a jump over scope(exit) leaks internal details #3295

Open
@dlangBugzillaToGithub

Description

@dlangBugzillaToGithub

basile-z reported this on 2023-12-25T16:10:14Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=24300

Description

The error output for

```d
extern(C) int puts(const char*);

int main () {
  goto L0;
  scope(exit) puts("meow");

  L0:
  puts("cat says");

  return 0;
}  
```

is 

> Error: cannot `goto` into `try` block

This leaks the fact that the exit scope guard is lowered to a try-finally statement,
a detail that does not necessarily interests the user or that can even be confusing

A better message would be

> Error: cannot `goto` skip over `exit` scope guard

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions