Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new error design #23098

Closed
23 of 24 tasks
hasithaa opened this issue May 5, 2020 · 1 comment
Closed
23 of 24 tasks

Implement new error design #23098

hasithaa opened this issue May 5, 2020 · 1 comment
Assignees
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/NewFeature

Comments

@hasithaa
Copy link
Contributor

hasithaa commented May 5, 2020

Implementation issue to track #ballerina-platform/ballerina-spec#509

Sub Tasks

Error Type descriptor

  • the error reason string is removed
  • the error type descriptor has a single type parameter, which specifies the detail record

Update to Error Detail Record and Constructor

  • message and cause move from the detail record into the error itself
    • the type is string and error? respectively
    • the message is required
    • the cause defaults to () if not specified
    • they are specified by positional arguments to the error constructor
    • lang.error provides message and cause functions to access them
  • the required type of detail record is map<anydata|readonly> (with no predefined fields)
  • the positional parameters of error constructors specify the message and cause
  • if the error constructor uses a type that does not specify a detail record type with individual fields, then named arguments can be used to specify arbitrary fields
  • if the error constructor uses a type that does specify a detail record type with individual fields, then the named arguments can only be used to specify those fields; other fields must be specified with ... and a mapping constructor (not sure if this functionality is really necessary)

Distinct Error Type

@hasithaa hasithaa added Type/NewFeature Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. labels May 5, 2020
@hasithaa hasithaa added this to the Ballerina 2.0-Preview1 milestone May 5, 2020
@hasithaa hasithaa changed the title Implement New Error type Implement New Error desgin May 5, 2020
@hasithaa hasithaa changed the title Implement New Error desgin Implement new error design May 5, 2020
@hasithaa hasithaa added the Points/5 Equivalent to five day effort label Jun 22, 2020
@KavinduZoysa KavinduZoysa removed the Points/5 Equivalent to five day effort label Jul 17, 2020
@hasithaa
Copy link
Contributor Author

This is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/NewFeature
Projects
None yet
Development

No branches or pull requests

6 participants