Skip to content

Add an option not to raise error #157

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

Closed
suzuki-shunsuke opened this issue May 31, 2024 · 2 comments
Closed

Add an option not to raise error #157

suzuki-shunsuke opened this issue May 31, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@suzuki-shunsuke
Copy link
Collaborator

suzuki-shunsuke commented May 31, 2024

Jsonnet doesn't support catching errors.

So if native functions throw errors, there is no way to handle them.
So it would be great if we add an option not to raise error.
Native Functions can return only one value, so there are two options.

  1. Return an object having returned values and an error.
{
  "values": ["support returning multiple values"],
  "error": {}
}
  1. Return a value or error.
{
  "type": "io_error",
  "error": true,
  "message": ""
}

To support an option, we have two options.

  1. Add new functions
pkg/regexp.MatchString
noerr/regexp.MatchString
  1. Add a default argument to function
pkg/regexp.MatchString(pattern, s, opts={})
@suzuki-shunsuke suzuki-shunsuke added the enhancement New feature or request label May 31, 2024
@suzuki-shunsuke
Copy link
Collaborator Author

@suzuki-shunsuke
Copy link
Collaborator Author

Rejected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant