You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following up the discussion in #144, I'd like to propose an alternative way to handle errors during wazero initialization.
Currently, go-re2 just calls panic in the init() function, which makes it quite hard in some (rare) situations to get any information about the error that occured.
The idea would be store the initialization error at the package level, and just returning in init() instead of calling panic().
The state of the error would then be checked in each entrypoint method in the go-re2 package, and returned to the user if something went wrong during the initialization.
The entrypoints are:
Compile
MustCompile
CompilePOSIX
MustCompilePOSIX
MatchString
Match
QuoteMeta
The only function that does not return an error/panics is QuoteMeta, but it's just a wrapper around regexp.QuoteMeta, so we could just ignore any initialization error in it.
For the others, the error would be handled the same way they currently handle errors (either returning it or calling panic()).
The text was updated successfully, but these errors were encountered:
Following up the discussion in #144, I'd like to propose an alternative way to handle errors during wazero initialization.
Currently, go-re2 just calls panic in the
init()
function, which makes it quite hard in some (rare) situations to get any information about the error that occured.The idea would be store the initialization error at the package level, and just returning in
init()
instead of callingpanic()
.The state of the error would then be checked in each entrypoint method in the go-re2 package, and returned to the user if something went wrong during the initialization.
The entrypoints are:
Compile
MustCompile
CompilePOSIX
MustCompilePOSIX
MatchString
Match
QuoteMeta
The only function that does not return an error/panics is
QuoteMeta
, but it's just a wrapper aroundregexp.QuoteMeta
, so we could just ignore any initialization error in it.For the others, the error would be handled the same way they currently handle errors (either returning it or calling
panic()
).The text was updated successfully, but these errors were encountered: