Skip to content

Commit

Permalink
Add a bit more to problem
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanTAllen committed Jan 21, 2024
1 parent cafc050 commit ce2cd4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/creation/static-constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ hide:

## Problem

You want to construct an object or return a meaningful error message. Unfortunately, in Pony there's no way to do that. Pony constructors always return an initialized instance of their class unless, the constructor is partial in which case nothing is returned as we jump to the nearest error handler.
You want to construct an object or return a meaningful error message if the object can't be constructed. For example, if a parameter is supposed to be in the range of 1 to 10, but 12 was passed. You'd like to return an error that "12 is out of range" instead of constructing the object. Unfortunately, in Pony there's no way to do that. Pony constructors always return an initialized instance of their class unless the constructor is partial in which case nothing is returned as we jump to the nearest error handler.

```pony
class Foo
Expand Down

0 comments on commit ce2cd4f

Please sign in to comment.